Announcement

Collapse
No announcement yet.

UE4Duino - Arduino to UE4 plugin Release!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Hi - has anyone managed to get this working on 4.13 ?
    I tried using the latest plugin after creating a c++ class in my game and installing Visual Studio. I placed the UE4DUINO folder inside a plugins folder in my project folder and re-opened unreal.
    I don't get any errors when opening my project, I can use the UE4DUINO serial nodes inside blueprint....the only problem is it doesn't read anything from my arduino. I've used this for my last project in v4.10 so I'm aware that the serial window must be closed in arduino. I'm working off windows 10. Any feedback would be great as otherwise I will have to install an older version.
    Thanks
    Joey

    Comment


      Hello grizly32,
      I have download UE4Duino for UE4.10 and I have trouble with Read functions. I have windows 10 on my computer so I know there are some errors there, but all of the others functions work perfect and now I am stuck. I wanted to try UE4Duino plugin 4.9 for windows 10 but your link doesnt work. Have someone solved the read functins for windows 10 yet and how?

      Comment


        Originally posted by ture1234 View Post
        Hello grizly32,
        I have download UE4Duino for UE4.10 and I have trouble with Read functions. I have windows 10 on my computer so I know there are some errors there, but all of the others functions work perfect and now I am stuck. I wanted to try UE4Duino plugin 4.9 for windows 10 but your link doesnt work. Have someone solved the read functins for windows 10 yet and how?
        For windows 10 try using the 4.8 or 4.9 that have a windows 10 version

        Comment


          I have tried using 4.8 and 4.9 plugin for Unreal 4.8 and 4.9 projects, but have still error with Read functions.

          Comment


            Solved it with Arduinokit plugin for UE4.

            Comment


              Originally posted by AliasOmega View Post
              Hi John so I finished this for a University project I'll link you the blog where we finished our work. Though I'd appreciate if you didn't send it as a private message and keep on the forums so other people can see this. Note of warning though as it wasn't fully finished just the wheel and it was done with the steering not fully completed but should give you an idea of what we did. Not sure about some of your issues, you need to be a bit more in depth like which arduino were you using, hows your arduino code, blueprint setup etc. Good luck

              http://thedrivingmachine.blogspot.com.au/
              how about 4.13?

              Comment


                Originally posted by Link_AJ View Post
                Got this working on 4.13.1 on Windows 7

                Download UE4Duino_4.10 plugin
                Open your UE4 4.13 project first, then add an empy C++ class (even when you're only using Blueprints, this will convert your project to be C++ compatible, you need Visual Studio 2015)
                Save and quit your project, then make a Plugins folder in your project and copy UE4Duino_4.10 into it.
                Start your project again, now it will ask you to rebuild the plugin, click yes, and the plugin should now work with 4.13.1

                I'm a complete beginner with Arduino, but so far I managed to toggle the little light on and off on the Arduino board, by pressing a button in UE4.
                Assure it works in win10+UE4.13+visual studio2015.The important thing is to convert your project to be C++ compatible first and UE could build the plugin.

                Comment


                  Hey Grizly32,

                  I found your plugin works well in 4.10.4, however the new version (4.13) doesn't recognize your plugin (version 4.10). also it often crushes when was running on unreal 4.10.4.
                  Please let me know is there any means that I can fix this issue, or any means to run your plugin on unreal 4.13?

                  Many thanks!

                  P.S: your plugin is awesome!

                  Comment


                    [UPDATE] Rewritten from ground, packagable, several Arduinos at once and no crashes so far

                    UPDATE!

                    UE4Duino 2.0

                    First of all, thanks a lot to [MENTION=34167]grizly32[/MENTION] for saving me time on understanding how to use serial ports on C++ in Windows!
                    I've rewritten the plugin from ground up, but wanted to keep grizly32's credits for the name and his initiative.

                    The zip below contains binaries for UE 4.14.0, but it should compile successfully since 4.11. Maybe even lower.
                    Download: UE4Duino_4.14.zip

                    Attention: if updating it on an existing project, beware! You'll need to change some stuff as it now works on instanced variables instead of a static connection.

                    USAGE
                    • You can use the Construct Object From Class node to create an instance of the Serial class and use the Open COM function to start the connection.
                      Click image for larger version

Name:	Example2.jpg
Views:	1
Size:	50.9 KB
ID:	1118758
                    • Or you can use the static function Open COM Port, which will create the instance and open the port for you. Just remember to store that instance in some variable to use later!
                      Click image for larger version

Name:	Example.jpg
Views:	1
Size:	135.8 KB
ID:	1118757
                    • ALWAYS call Close COM before quitting the game (like on Event End Play). If you fail to do so, you won't be able to reopen it unless you reconnect the device to the PC.
                    • For now, you have to check for input on Tick. Whatever kind of input you read for, it'll return Success=true if there was input. But I intend to create a thread just for checking and notifying input changes with events.


                    CHANGE LOG
                    • Code is more Unrealish: hide windows platform types; switch from TCHAR[] to FString; use FMemory methods; int32 instead of int; bool instead of BOOL etc.
                    • Works with COM10 and above. (If you change your COM to test it, you need to reconnect the device).
                    • Condensed everything into a single class: Serial.
                    • Not threaded. Reading when there's no data to read will return instantly. When reading serial inside Arduino code, remember to use Serial.setTimeout(10) on the setup function, so the Serial.readStringUntil (and other functions that interpret a group of bytes) return faster.
                    • Added functions to read and write numeric data types (float, int, byte and byte array). On the Arduino side you must know how to convert byte arrays from/to these types.
                    • Added ability to read Strings by line or whole string found in serial.
                    • Added ability to work with more than one Arduino (COM) simultaneously. The class works with instanced objects instead of static variables.
                    • It packages successfully (tested on Development and Shipping modes).
                    • Changed logo and "Creator" on plugin description as I mostly rewrote it. But kept the name as it's very nice and [MENTION=34167]grizly32[/MENTION] deserves its credits for starting the thing. Hoping he won't mind much.
                    Freelancer Game Dev Generalist and Unreal Consultant | Portfolio
                    Unreal products: Dynamic Picture Frames, Neo Kinect

                    Comment


                      Awesome man, I was running into trouble with the old plugin, with the packaging of the game. Are there any special instructions for packaging the game for Windows 64 bit to include the plugin?

                      EDIT: It works, you're a lifesaver. I've been working on this project for weeks and the deadline is tomorrow. The game finally cooks including the plugin, and correctly works as standalone game now.

                      EDIT2: Let me thank you again, your update really came just in time. I'll record a video later this week of our VR + Arduino setup, it has turned out pretty cool.
                      Last edited by Sleeper.; 11-23-2016, 07:24 AM.

                      Comment


                        Hey, I've been having trouble with ue4duino and this new plugin made by RVillani for the past three days, I thought changing to the newer version of the plugin might work but it doesn't. I'm trying to make Unreal output through my Arduino and I do have a serial connection between the two, the problem is that any data I try to send to the Arduino doesn't seem to go through. I'm relatively new to Unreal Blueprints and Arduino so I don't know what I'm doing wrong, can I get some feedback?

                        Here's my blueprint:
                        Click image for larger version

Name:	Capture2.PNG
Views:	1
Size:	257.4 KB
ID:	1118979

                        And here's my Arduino code:

                        String input;

                        void setup() {

                        pinMode(12,OUTPUT);
                        digitalWrite(12,LOW);
                        Serial.begin(9600);
                        input = Serial.readString();

                        }

                        // the loop routine runs over and over again forever:
                        void loop() {



                        if(input == "palm")
                        {
                        digitalWrite(12,HIGH);
                        Serial.println("PALM");
                        }
                        else if(input == "off")
                        {
                        digitalWrite(12,LOW);
                        Serial.println("OFF");
                        }
                        }

                        Thanks
                        Last edited by Painapple; 11-27-2016, 05:18 PM.

                        Comment


                          Hi,
                          thanks for your contribution. Helps a lot.
                          But I find something wrong. I'm using 4.10 version. When I first start the project, and choose ''play'' in the toolbar, if I send nothing from Arduino, the readserial funtion will act but won't return anything. That's right. Because I indeed receive nothing.
                          Then I send sth from arduino, the read function will receive successfully. However, after I stop playing, and playing the game again, also I send nothing from arduino, the readserial function will act and return a value which is the same as the last time. But actually the readserial function receive nothing. It seems when playing the game again, the read buffer was not cleared and remain the value received latest. [MENTION=34167]grizly32[/MENTION] could you help me? Thank you~

                          Comment


                            Does anyone have experience with splitting multiple values from Arduino? For example, I have 2 values input - the 1st for forw/backw movement, the 2nd for rotation. I have to make UE read them separately. How I can do that?

                            Comment


                              Originally posted by John Michael View Post
                              Has anyone tried controlling a 120V AC Fan with an Arduino before? If you would would you be willing to share your circuit and sketch?
                              Originally posted by Gabriel Lima View Post
                              Can you specify the fan? i can make a sketch for the circuit for you.

                              Or just look for Relay Shields but take care with the inrush current, i almost burned my arduino last year because of it.

                              Career Electronics Tech here. If you are going to be controlling anything with an Arduino I would suggest at the very least that you use an optocoupler so this way what you are controlling is electrically isolated from your Arduino and PC.

                              But for controlling a device such as a fan I would suggest this You can find hundreds of such devices and most likely Arduino's have their own brand of one as well. Electrically it most likely will look something like this, Those nifty blue arrows in that box indicates that the diode and transistor there communicate via light and thus are not electrically connected to each other. Click image for larger version

Name:	Relay-Module-Circuit-Schematics.png
Views:	1
Size:	11.9 KB
ID:	1119258



                              Although really if you are driving anything more than an LED or logic, but something that is not attached to a high current source I would suggest some form of isolation, such as the attached image. This will let you power said device without having said device being electrically connected to your machine.
                              Click image for larger version

Name:	201142721549346.gif
Views:	1
Size:	31.6 KB
ID:	1119257

                              Some words of caution:
                              1- Unless you are driving logic, do not connect the ground of your high current circuit to the ground of your digital circuit. This is step one of bad things happening, so don't take it.
                              2- Think of coils (such as the ones found in relays) as magnetic rubber bands. it takes a relatively long time to build the magnetic field but it will collapse very quickly and produce an inverse voltage spike, that is why you see that diode (and sometimes a ceramic cap) across the contacts for the coil. that is a protective device for both your safety and the safety of your hardware.
                              3- If you are working with a 120V line please make sure that your work looks neat, and that there is no way that connections can come loose and no exposed conductors, most likely you will live through a jolt from a 120V line but that is not written in stone, and accidents with those can cause a fire.
                              4- There are IRC channels dedicated to electronics on #freenode, and provided you have a good camera you can most likely find someone to help if needed.
                              5- Electrical Tape is the devil, don't use it. Use heat shrink.
                              6-Use an inline fuse if you are driving something with line current, it will help make sure that your local fire fighters are board.
                              Last edited by scurv; 12-03-2016, 02:06 AM.

                              Comment


                                Hello,
                                first thanks a lot for the plugin! I am a newbee in Arduino/Unreal and it helps a lot to start with it. Yet there are some questions left. In my project I connected a switch-button via Arduino to UE, the Arduino-Script prints out eather "0" or "1". With it I would like to control some actions in Unreal, for example the color of a light. Now one point is: The communication between Arduino/Unreal is working, but the reaction of the "Read Line - return value" is quite slow in UE (by the way in the previous plugin, it was´nt the case). I increased the Baud Rate to 4800 already which results in a better reactiontime. But I don't know how it affects the program in general, maybe you have an idea, what to do?
                                The other question I have is how to continue with the recieved values. I made an equal (string) test as a condition, as it worked in the previous plugin, but somehow now it has no effect. Maybe another method is needed, but I don´t know what to do. Maybe you have a hint. I attached a screenshot. Best!

                                Comment

                                Working...
                                X