[Free][Windows only] UE4Duino 2 - Arduino (COM port) communication

Thank you for your comment. ^^.

My purpose is to control Unreal with external input.

Please make sure it is what I understand.

EX)

1 arduino connection PC.

1 arduino + 1 bluetooth module + 1 external input

-> External input value is communicated with arduino connected to PC by Bluetooth effect in unreal.

(px. I can not speak English, so I’m referring to the translator.)

I don’t know if it is because of the translation, but you were missing some things there.
You’ll need:

  • 1 Arduino connected to the PC. This Arduino must have a Bluetooth module configured as receiver.
  • 1 Arduino not connected to the PC. This Arduino also has a Bluetooth module, but configured as sender. And it would be the one that gets the input to send it to the other Arduino (the receiver).

Input would be sent from the sender Aduino to the receiver one and the receiver one would send it to Unreal.

It’s perfect.
Thank you!!

Um dumb ■■■ question. Ive got this plugin all set up and running with the Arduino. In the arduino code if i have a changing float called ‘sensorValue’ how do I convert that to the serial byte that Unreal expects? in the Arduino example the bit about the Float says:

float fVal = 12.34f;
byte* fBuffer = reinterpret_cast<byte*>(&fVal);
Serial.write(fBuffer, 4);

what is12.34f? some arbitary? float?

so could i do this???

float fVal = sensorValue;
byte* fBuffer = reinterpret_cast<byte*>(&fVal);
Serial.write(fBuffer, 4);

Yes. You could. And if sensorValue is already of type float, you can just use it directly:


byte* fBuffer = reinterpret_cast<byte*>(&sensorValue);

12.34f was indeed an arbitrary value with an easy to remember sequence of numbers to make sure that the value was being translated correcly in Unreal, even its decimal part.

Hi, do you have any plans on updating the plugin for UE 4.20? I’m working on a music driven game where we’re looking to construct our own instrument and connect it to Unreal using Arduino. We could use 4.17 but we’d prefer to have use of the Niagara editor in 4.20. Cheers!

I created Plugins folder inside Content folder of my project and dragged and dropped the UE4Duino foler, but it gave me a bunch of errors like,
Unknown extension ‘response’, Unknown extension ‘exp’ etc. What am I doing wrong? Thanks.

UE 4.20.2 binaries released!
DOWNLOAD

Hi, guys! I know it took me a bit to update it to 4.20, but for some reason I wasn’t getting notified about messages in this thread.

Hey @, great plugin!
We use it to send simple signals to different arduino devices and noticed that we have to delay between each print because otherwise they interfere with each other. Unfortunately the delay time doesn’t seem to be very consistent. Is there a way to know when the signal is done sending so that we can send the next one? Thanks!

There’s a way, but you have to create it. It’s a basic Serial communication. Very straight forward: send and receive data. There are no checks if the data was correctly sent etc. So, when I need precision, I create a protocol, like HTTP and others, that expect data in a specific format and, if it’s not that way, requests again or wait for the next package.

Here’s an explanation of how I do this protocol.

Hi @ Thanks, but even if I used the 4.20.2 version (I have updated UE to 4.20.2 as well), I still get following error,

Failed to import ‘C:\UE4Duino_2.2.1_4.20.2\UE4Duino/Intermediate/Build/Win32/UE4/Development/UE4Duino/Module.UE4Duino.gen.cpp.obj’. Failed to create asset ‘/Game/Plugins/UE4Duino/Intermediate/Build/Win32/UE4/Development/UE4Duino/Module_UE4Duino_gen_cpp’.
Please see Output Log for details.

Failed to import ‘C:\UE4Duino_2.2.1_4.20.2\UE4Duino/Intermediate/Build/Win64/UE4/Development/UE4Duino/Module.UE4Duino.cpp.obj’. Failed to create asset ‘/Game/Plugins/UE4Duino/Intermediate/Build/Win64/UE4/Development/UE4Duino/Module_UE4Duino_cpp’.
Please see Output Log for details.

Failed to import ‘C:\UE4Duino_2.2.1_4.20.2\UE4Duino/Intermediate/Build/Win64/UE4/Development/UE4Duino/Module.UE4Duino.gen.cpp.obj’. Failed to create asset ‘/Game/Plugins/UE4Duino/Intermediate/Build/Win64/UE4/Development/UE4Duino/Module_UE4Duino_gen_cpp’.
Please see Output Log for details.

Do I have to install something else before the import? Thanks.

That path is not making sense to me. It looks like you are not extracting the plugin’s contents into a Plugins folder.

This is a plugin and, in Unreal, plugins go into a Plugins folder, inside your project folder. Try this:

  • Create a new project from the Launcher. Let’s say you call it ArduinoTest.
  • After the project is created and opened once, close it and open its folder, where the .uproject file resides.
  • Create a new folder and name it Plugins.
  • Extract the zip content into the Plugins folder.
  • Launch the project again, go to Edit > Plugins, on the left scroll to Project Plugins and enable UE4Duino there. Then restart the project.

With this structure, the Intermediate folder path should be something like …\ArduinoTest\Plugins\UE4Duino\Intermediate.

Firstly thanks for such a great plugin it really is a big help. I have an issue that is most probably with my basic understanding of serial communication and would appreciate any help I can get.

I have a device that has two EMG sensors (channel 1 and 2) that provide a value. When I run it through a RealTerm terminal with baud rate 19200 and displaying uint8 where I get the correct results when idle

[FONT=“Calibri”]and when the sensor is given a signal I am given the correct value.

[FONT=“Calibri”]I used readbytes to get the data in Unreal but do not get the same data when idle

[FONT=“Calibri”]or when it has a signal.

[FONT=“Calibri”]I am at a loss at what I am doing incorrectly, the blueprint is most likely incorrect. If I have made this post overly confusing I am happy to clarify anything.

Hi - I’m trying to use this plug-in in 4.20.2.
I have activated the plug-in and I have the nodes to “activate port” I seem to only get “Port not Open”.
I’ve tried Arduino on various Ports, baud rates, etc…Any thoughts for a newb thing I’ve skipped? Thanks! —

FYI - I tested the plug-in 4.19.2 it works just fine…Anyone else having trouble with 4.20.2?

If you are just reading values, you don’t need Print nor Delay. But I don’t know what is the actual problem… bytes should always be the same. They are the smallest unit of data you can transfer, so they can’t be broken apart like floats and ints and have their values altered. I really don’t know what’s going on there yet. What is the function being used in the sensor to print the values?

I’ll be honest: I was in a hurry when I updated it and I just updated the coded and checked if it was packaging without errors. So I’ll have to test it with my Arduino, but I don’t see a reason why it shouldn’t work, since the main part of the code is Windows code, not Unreal’s, so no fatal changes were done there. Are you having the problem on a packaged version or in the editor?

You are a legend, it works now. It was given different value when I was using print. Thanks for your help it was really appreciated. I am using it for a research project to help amputees learn how to use a prosthetic arm in VR. Here is a link with some more details if your interested https://www4.shu.ac.uk/mediacentre/ground-breaking-vr-research, thanks again.

I was just trying output in the editor. Initially I tried the plug-in with my VR/mixed reality project…(4.20.2 it didn’t work.) I created a clean FPS project (4.20.2) and tested it again. Didn’t work. I thought the best way to test would be to backtrack…So I re-installed 4.19.2 and the previous plug-in version. It works fine in 4.19.2. **I’m guessing 4.20.2 is not working ** (but I never rule out it’s something I did and/or some other plug-in I have installed). I really appreciate you have this plugin! So great!

That’s great, man!! Keep it up! :smiley:
It’s awesome when we are able to use something like a game engine to help humanity!

I want to test it as soon as possible, but this week I’m on two tight deadlines, so it’ll be really hard to focus on the plugin.