Connecting Arduino to ARC
Description
Program an Arduino and connect it to ARC to become an EZ-B.
Related Robot Skills
Compatible Arduinos
This tutorial currently covers what Arduino's are compatible with ARC, where to download the firmware, how to flash the Arduino and connect to ARC.
Once you follow this tutorial and program an Arduino, you will be able to connect an Arduino to ARC and control the Arduino. Essentially, you will be converting an Arduino into an EZB. The best part about this is having access to the source code means you can add new functionalities to the Arduino and extend the capabilities of ARC. The one item to note is each Arduino will have different capabilities or lacking capabilities (i.e. video, audio, etc.).
ARC Version
- This feature works with ARC 2019.01.31.00 Beta or newer
Arduino Capabilities Additionally, each Arduino model will have a different MCU (microcontroller) with different capabilities for servos, PWM, and Analog. Consult the datasheet/manual of the Arduino you're using to ensure you understand what ports are available for different commands. For example, some Arduino models only allow PWM/Servos on specific digital ports. Meanwhile, other Arduino's share I2C with Analog ports. You will have to determine what ports are available because we have no idea due to the number of Arduino versions out there. For example, servo ports on Arduino UNO must be PWM ports 3, 5, 6, 9, 10, and 11. These limitations are that of the Arduino libraries and hardware.
There's a significant number of Arduino's variations out there each with slight modifications. This means the base firmware provided in this tutorial can be modified for various Arduino configurations. Also, you are free to add new features to the Arduino firmware and register them as Capabilities to be used in ARC. But, that's a future edit of this tutorial.
*Arduino Mega showed in the picture aboveCompatible Official Arduinos The ARC software is compatible with a number of Arduino products, which the firmware can be found on their respective pages. Find your Arduino board and download the firmware from this page: https://synthiam.com/Support/Hardware/Hardware-Overview
Download the firmware source code for your Arduino version or compatible from the above link and continue to the next step of this tutorial. *Note: compatible or clone Arduino's will require a toolset and library installation to compile the firmware. Check the Arduino compatible product manual for instructions on adding libraries and tools to the Arduino IDE for clone hardware.
Thanks DJ, should prove a valuable tool!
:D
Wow. This is not what I was expecting when you said you were adding Arduino support. I thought you were going to have a pre-written application for connecting to an Arduino to extend the capabilities of ARC, or maybe the ability to compile scripts or autopositions into arduino apps that could run independently of an ARC computer for simple robots (still think either of those would be cool things) but this is a total surprise. Still processing what it all means, but I think you just dramatically reduced the price of entry for hobbyists.....
Alan
Double Wow! And I have only tried two digital and one PWM control. As soon as people see the power of ARC everywhere - well, I just hope I can keep up.
Thanks - good news is if you want to hard program sequences into the arduino, go ahead. The code is there so you can add your own commands or what ever you’d like to do. The capability firmware section of the website is being worked on. But essentially there will be a place where you can obtain a unique firmware ID that ARC recognizes and knows the capabilities. That way there’s an understanding between controls and hardware of what’s compatible when you make your own firmware with new features.
Another game changer from Synthiam! Nice job!
when i get home I will be al over this .....so cool...thanks DJ [font=OpenSans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"]Synthiam!
Pardon my ignorance. Does this mean that I can now operate one of these platforms directly with ARC without having to go through an EZB? Would I be able to use EZ Script commands?
Dave - best to read the first 2 paragraphs of this tutorial
Very interesting, hopefully this does not stop/limit any future hardware development like say a newer EZ-5 controller.
Wow, this is very interesting and as others have said a Game Changer!! This definitely opens up a ton of questions, but I’ll have a play around with this first.
Has anyone gotten it to work yet? I'm in need of some assistance please.
The only servo response I've been able to get is on "D0" of my UNO. No other pin combination responds. Even then, I seem to have wrong speed and position, as my small servo barely moves between 0-90 and only in one direction. Its also backwards in the "Servo Summary." Speed scroll moves position setting and position scroll moves speed setting. I'm guessing I have a few things set incorrectly or perhaps way off base. I'm green at this, so take it easy on me.
Whoops...Hello by the way! This is my first post and first time ever using ARC. I don't know about anything else here yet. I just downloaded it tonight and jumped in with my Arduino and servos. Sorry if this is the wrong place to ask questions, but I haven't found a user forum yet. thanks!
:DHey there, Welcome HuneyBee Glad you have jumped on trying ARC on your Arduino! I am very curious to see if anyone does get this working out!
I followed the "'Connecting Arduino to ARC" step by step and loaded the Arduino Uno firmware OK onto my Arduino Uno board.
But I get the following error message when attempting to Connect to the ARC.
03-Feb-19 4:36:24 PM - Attempting connection on COM3 03-Feb-19 4:36:25 PM - Connected to COM3 at 57600 03-Feb-19 4:36:25 PM - Reports 222 03-Feb-19 4:36:47 PM - Connection Failed: System.Exception: This device is not an EZ-B. Please follow the online tutorials on the EZ-Robot website. at EZ_B.EZB.o412JueFyx() at EZ_B.EZB.Connect(String hostname, Int32 baudRate) 03-Feb-19 4:36:47 PM - Disconnected
Could it be I'm using a Arduino Uno+ board, rather then a standard Arduino Uno board? The boards should be identical apart from the Uno+ has more features regarding power pin-outs and USB.
Hunnybee: welcome! That’s interesting - what servo shield are you using? And are you powering the uno with a battery? It won’t run off usb. The ports D0 and D1 won't be used on the Arduino because they are reserved for DEBUG and USB communication on all Arduinos. So the firmware has the ports D0 and D1 ignored. The reason you may see servos on D0 or D1 move is due to the USB traffic. There's no way to control D0 or D1 from ARC because it's reserved for the USB on all Arduinos.
Something else to notice which is bizarre on the arduino servo shields is they seem to provide servo power from the voltage regulator, which means +5 volts. That's not very useful because most servos will brown-out the pcb.
Cem: you’re not using the beta ARC.
Thanks JD, Yep, I didn’t read all the requirements!!
ARC Version
Thanks everyone for the welcomes. Also thanks for updating the code. I uploaded the latest version. Now I have much more success than my first time around using the UNO. I am getting the servo responses I expect, though I still have a lot to figure out in general.
I started printing an INMOOV head as my first project, but I had to shelve it for a number of reasons. I haven't decided what else will be my first robotics project, but it will definitely be much smaller scope. I'm excited to learn about ARC. I hope to see you all around here somewhere. Thanks again!
How are builders communicating between ARC and the supported platforms? When using an EZB you have WiFi connectivity from your computer running ARC. I have never touched an Arduino but I do know you can buy shields for them. Would I connect through one of these?
Dave, My thoughts as well, at the moment I have it hardwired through the USB cable connected to the PC, but this is just to try things out. Thinking about a Bluetooth connection via Arduino Bluetooth shields boards to make it remote??
Cem, then maybe you didn’t select the correct baudrate? Follow each step of the tutorial and you should be good
DJ, After loading the Beta version I can connect the ARC to the Arduino Uno+ and all works fine, and have the baudrate at 57600. Have a servo on D3 and working OK.
You might of misunderstood what I was trying to say above, regarding having to have the USB lead hardwired from the Arduino to the PC/Laptop. Where I think Dave was asking can you use it wireless like with the EZ-B V4 or IoTiny using wifi, without the USB lead. That's why I mentioned about may be this can to done via the Arduino Bluetooth shields board??
Yah - that's the good and bad with arduino. You can use it wirelessly if you know how to do it. There's no standard with Arduino so there's nothing i can directly support. You'll have to modify the code to use a different UART interface for wireless shields. Take a look at the most recent firmware sourcecode that i updated today (Feb 4, 2019). I put comments in the code header so you can see what i mean. Just change the COMMUNICATION_PORT from Serial to Serial1 or Serial2, where ever the shield is connected
Why wouldn't connecting a Bluetooth to I/O pins 0 and 1 that are replicas of the USB serial pins and then pairing the Bluetooth with your PC Bluetooth to get the virtual serial port work without modifications to the firmware?
FYI It works fine over bluetooth... You have to modify the arduino source code to use 9600 baud not 57600
That's not bad RichardR, Cool! I'm surprised the Bluetooth virtual serial port won't run higher on the PC, bummer.
You can configure most bluetooth modules for a higher baud rate. Check the manual for the bluetooth module. They usually use an AT command set
Tiny question, will there be an option at some point to write a sketch for the arduino and load it using tools in ARC so that a arduino could function untethered from a PC for low level tasks?
Second Question: any plans on integrating the Raspberry PI 3b plus and pi zero W into this, since it has pretty much everything built in you could need ( kinda sorta)
You can use the Arduino IDE to program arduino chips. It would be a lot of duplicated effort to create an arduino editor in ARC.
We explored raspberry pi options and while that question doesn’t align with this tutorial, the answer is yes we’re working on a design - but it’ll take some time to ensure there’s no sacrifice of features for cross platform compatibility
Is the ESP8266 or ESP32 going to be considered in the future? I ask because it is WiFi enabled, very cheap and can be programmed with the Arduino IDE.
I can certainly take a look at it. The only challenge will be their tcp network driver won’t keep up with the protocol requirements. We had to design our own for the use-case. Also, it’ll end up with the same number of ports as the IoTiny but no audio or video. So what’s the advantage?
I think you should have a look at the [color=#333333][font="Helvetica neue", Helvetica, Verdana, sans-serif]HuaDuino - Featuring Lithium Battery Power-up and Charging. this board has 12 servo connections. [color=#000000][font=Arial]HuaDuino is Arduino Nano compatible [/font][/color]
That board appears to be uno compatible for pinouts. It’ll work with my uno firmware. Get it from here: https://synthiam.com/Hardware/Hardware/Arduino-Genuino-Uno-17527
Thanks DJ for your quick reply. any recommendations for a bluetooth module that would go with this board and work well with ARC.
Any for that board will work. They just create a virtual COM port in Windows, which you select in ARC.
All these updates are so exciting!
DJ, I assume you can use the EZ-B as connection 0 and add the arduino to connection 1 to give yourself additional I/O correct?
What If the arduino has WiFi already? Can we use it wirelessly?
Yes to the ezb #1
yes to the WiFi version of arduino. Look in the getting started guide for the WiFi enabled arduino
Great tutorial
I used my Arduino today, com3 on ARC
sharp sensor:
used port ADC3
sharp IR radar
ADC graph
ADC meter
ADC read
All went well
That's great news! Appreciate the feedback
@DJ-Sures,
Any updates on adding "Capabilities"? I'm looking to use an Arduino Mega as an EZ-B controller, but need to add (I think?) a library to manage some Neo Pixels. Any thoughts or suggestions?
Thanks,
John
John, think you want this: https://synthiam.com/Products/Controls/Misc/Neopixel-Ring-16158
So, not quite. If I'm reading that correctly, its flashing the Arduino sketch in that post and then the control plugin is connecting to that Arduino and its sole purpose is to run the ring? I'm trying to add the neopixel library to the EZ-Mega.ino sketch and run two rings and a strip. Am I overthinking it, or is that the right path?
***Update. so I added the library in the Arduino sketch, defined the strip, and have the lights animating via the sketch. I can still connect to the Arduino from ARC so that part isn't broken. My question now would be, how can I add a new function and call that from ez-script? I think that will give me what I'm looking for.
***Update 2. Ok. so I pretty much figured out that I need to add all the custom functionality to the Arduino sketch that I want (in progress), add a custom firmware (https://synthiam.com/Firmware/NewFirmware), add a new version and upload my firmware while also requesting the New Capabilities (https://synthiam.com/Firmware/NewCapability) that I'm adding. Whew. Will make the firmware available when (let's be honest, if) I get it finished.
Did you see my Happy New Year Mr. Roman robot with Arduino uno - make sure you click on the icon on the connection - then go to settings, change the serial connection to 57600
Noggin - i can revisit the neopixel with arduino on a future live hack... I tried it last spring but man, neopixel isn't my favorite. They use A LOT of power and drain batteries super quick. Also, the whole way they work is kinda wacky... the arduino library didn’t work for me in my past live hack. Might be able to find the archived video somewhere on here and see if I made some mistakes that you could fix?
lots of people seem to like the idea of neopixels because of the convenience. Let's see what we can do...
DJ Sures - Some of your live hacks were taken down with a DCMA request, it appears, but I've watched #4 which got me started on the custom firmware. I've baked in basic functionality to the Mega sketch, but don't know how to add the EZB Protocol commands on the software side. I presume thats via the capabilities request, which I put one in last night, but think I did it wrong. Essentially, if I get all the functions added to the sketch, and provide a list of the new Protocol commands that are needed to call them, can you add those to the app? We'd need to coordinate on what bytes to send for the commands, but I modeled it after the command/sub command structure I saw. I can send you a current copy of the firmware if you'd like to see what I was working on.
Let me know! Feel free to pm me at my profile email address.
Should I be able to control the speed at which the servos move when using an arduino? I have tried ServoSpeed and every thing I can think of and the servos still move at full speed. There doesn't appear to be any arduino code supporting CmdSetServoSpeed .
Please help.
Rhfinch - the Arduino ezb firmware does not support the servo speed capability. The list of capabilities for a ezb are displayed in the lower log when connected.
also, the firmware webpage where you downloaded it from has the list of capabilities.
The work around for servo speed is to use the Auto Position control.
Thanks. I'll look at that.
Hello need help, i have an excavator project and i want to check with your software, how to start?. The excavator has an arduino mega, esp2866, 2x L298N
Welcome. Start with the getting started guide in the support section: https://synthiam.com/Support
ok, I managed to master your excavator software works on the cable now it remains to buy raspberry for wfi. will pc steering wheel work to control?
Awesome!
For WiFi i would recommend an EZ-Robot EZ-B v4 or EZ-Robot IoTiny from here: https://www.ez-robot.com/Shop/
Because they have Audio & Video
and the steering wheel will work like here https://fb.watch/2QEtOdmE84/ ?
Has there been any updates on the tutorial on how to customize the firmware? I was really hoping I could use ARC to bridge an arduino UNO with an LCD panel and a laptop to do some more robust AI stuff
Hey Lipe, what specifically are you looking for to customize the firmware? You'd have to learn how to program in Arduino to customize the firmware. There's nothing specific about the firmware that requires any additional knowledge. Simply open the arduino firmware sketch into the arduino editor and modify the pieces you're interested in.
However, if you merely want an LCD panel, then that doesn't require the firmware to be modified. You can start by getting a Serial (UART) LCD panel. Then, you can send Serial commands through the Arduino from ARC to the LCD.
Here's a link I found that will be helpful: https://synthiam.com/Community/Questions/Lcd-Display-Help-1165/comments
Hello everyone,
I am using Arduino Mega and controlling it with ARC. Currently communicating through the USB port COM3. The Arduino Mega has 53 ports. EZB only seems to let me have dropdowns to program 23 pins. 23 pins, that's it? Am I missing something with an option?
I 3D printed Johnny 5's head from the movie Short Circuit. I have servos for every little part, relay boards, RGB eyes, lasers, voice and there's just no more room for another Arduino board for yet another COM port. I put so much into this project. Rebuilt so many times. Cursed endlessly. Please offer any advice.
Thank you.
There would need to be a modified firmware and some sort of robot skill that extends the d24 ports to v ports. I’d have to think on that.
I have an idea for you, but it’ll take a few days to make
DJ Sures, Thank you so much for your response. If you do think of a way that would really be great. You have no idea how much I've already struggled. I knew I was already taking on a big challenge. Thank you!
I have some ideas. Running a few excitements but the plan is to allow a robot skill to extend the servo ports into the Vx ports for arduino firmware. Stay tuned and thanks for the kind words
Im excited, thank you again!
I presume you will use your Arduino Mega to control a mix of servos and digital ports.
One easy option: change the firmware code to map: EZB 0-23 servos to control arduino mega servo ports 0-23. EZB 0-23 digital ports to control arduino mega digital ports 24-47
so you can control 24 servos and 24 digital ports, is this ok ?
Oh that’s a good idea - it would be easiest change right away. Smart Ptp
DJ taking in consideration Arduino Mega hardware limitations:
I would map the following: Analog: A0-A7
Servos: mega ports D22-D43 = 22 Servos = EZB 0-21 mega ports D68-D69 = 2 Servos = EZB 22-23 Total = 24 servos
PWM Ports: mega ports D02-D10 = 9 ports = EZB 0-8 mega ports D13 = 1 ports = EZB 9 mega ports D44-D46 = 3 ports = EZB 10-12 Total = 13 pwm ports
Digital Ports: EZB 0-12 = same as PWM ports in mega (above) EZB 13-14 = D11-D12 = 2 ports EZB 15-20 = D62-D67 = 6 ports Total = 21 ports ( 8 exclusive for Digital IO and 13 shared with PWM ports)
pin 0 and 1 are serial port 0 / usb port (avoid these ports)
and you have the following: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX).
I2C: D20 - sda D21 - scl
With the above setup: 24 servos 13 pwm ports / digital ports 8 digital ports 8 analog ports serial ports available/free i2c available/free
Super smart. I like it! I’ll make changes and publish. This will be much easier. Thanks again for the idea ptp
I made the firmware changes to the mega firmware for the pins that ptp outlined. I have a mega on order and it should be here in a few days. I'll be able to test it before uploading the firmware. Stay tuned
That's awesome thank you!
Got the mega - modified firmware. Will be testing today. Expect new firmware online in the next few days
Hey DJ Sures, How is everything? I just got back from a work trip and excited to work on this again. I might not be sure where to look for new versions or changes to firmware. Were you successful in getting the Arduino Mega to run the change?
The latest Mega firmware and the port mapping can be found here: https://synthiam.com/Support/Hardware/Arduino-Due-Mega
Hi DJ, When I click on the link to download the latest mega firmware I get this message...; please advise. Thanks.
"Hi there!
Looks like you are lost!
What you are looking for is not here. If you think this is a mistake let the humans behind Synthiam know that there was a 404 error when you tried to access this page by sending an email to info@synthiam.com."
Edited: I move this question to hardware.
Having trouble programming this is the error message: C:\Users\Richa\AppData\Local\Temp\Temp3_po0o1stu.zip\EZ-Mega-v1\EZ-Mega-v1.ino:16:10: fatal error: SendOnlySoftwareSerial.h: No such file or directory #include "SendOnlySoftwareSerial.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
exit status 1
Compilation error: SendOnlySoftwareSerial.h: No such file or directory
Figured it out, I did not create a file in documents.
It would appear you are missing a file. Download the package and ensure you have uncompressed and extracted all of the files included. You will receive this error message if you do not uncompress all files.