- Home /
How do I use servo motor as output in arduino uno from touch controllers in unity3D?
I wanna build a haptic feedback with servo motor and arduino uno by moving the controllers in vr (along with oculus rift), but I'm not sure how do I do it. I didnt find many tutorials in how to integrate arduino (as output for moving the servo) and unity, mainly videos without any explanation or download option, the best one was that, one where a robot give servo output: http://bartneck.de/publications/2015/unity/TUTORIALUnity.pdf But even then, it just suggest to download the game and there are no further explanations in the hardware setup in unity I've downloaded the ARDunity asset, it have some servo examples and it worked just fine, but the documentation is poorly made and we walk blindly trying to make different things from the examples given. Apparently the Uniduino asset has vr and servo and looks easier to work, but costs 30 dollars and I dont have the money So, what do you suggest me to do?
Thats strange your asnwer disappeareded, meat5000 Could you write it again?
Answer by meat5000 · Jan 06, 2018 at 01:57 PM
Unity should not handle time sensitive data flow. It can not handle the servo-controller as differences in fps and hence output will cause large instability. The Arduino should completely handle the Controller and Unity can be used to give Directions to the controller - more of a suggestion than a command.
Data can be output via a custom .dll (simple data only, will be required) and handed off to a dedicated line handler, or possibly handled directly via networking from within Unity.
You may find that working your Servo controller at a decided 'Tick-rate' might improve its performance and Unity 'linkage'; you can then repeat the last information received until new data is transmitted.
I didnt understand very well this part of your explanation: "Data can be output via a custom .dll (simple data only, will be required) and handed off to a dedicated line handler, or possibly handled directly via networking from within Unity." Since I'm not used to .dll files (never worked with them), it looks complicated to do this way I was thinking about using this package https://github.com/DWilches/SerialCommUnity for serial communication between arduino and unity The time sensitive data flow means that I cannot "print" the information about the directions of the touch controllers in a file at some miliseconds and read it everytime for the servo rotations, right? What do I use for a dedicated line handler? Is it easier than networking from within unity (something I never done either, I'm new at unity)? Anyway, thanks for your help until now
A dedicated line handler would be an exteral interface program that controls data flow across, say, a serial port and you can just throw data into the buffer and away it goes. I, personally, would find it easier to write such a program and have that talk to Unity (somehow) as Unity has methods of communicating outwardly but probably lacks fundamental hardware control. If you have networking set up on your Arduino you can probably even use some kind of Webserver interface to bridge between the two as www-talk isnt that difficult from within Unity.
But yeah, you can not rely on Time-sensitivity from Unity so having Direct Response of the Servo from Unity's output would be asking for disaster.
The 'input' the Controller responds to should be on the Arduino device and that input is Derived from the Unity data. This allows a large amount of control and stablisation.
Your answer
Follow this Question
Related Questions
Mixamo Animations not working in VR ? 0 Answers
VR Headset Simulator 1 Answer
AO of post processing causes transparency 0 Answers
AutoWalk Oculus Rift 0 Answers
How set game to Seated Experience? 0 Answers