This receives ADC data from the arduino of servo positions via I2C to an EZ-B
How to add the PWM Servo Feedback (I2c) robot skill
- Load the most recent release of ARC (Get ARC).
- Press the Project tab from the top menu bar in ARC.
- Press Add Robot Skill from the button ribbon bar in ARC.
- Choose the Servo category tab.
- Press the PWM Servo Feedback (I2c) icon to add the robot skill to your project.
Don't have a robot yet?
Follow the Getting Started Guide to build a robot and use the PWM Servo Feedback (I2c) robot skill.
How to use the PWM Servo Feedback (I2c) robot skill
Receive servo positions in real-time over an Arduino and its ADC ports. This control connects to an Arduino over I2C and receives the values of the ADC ports. The Arduino requires firmware to be programmed, which can be downloaded below. Depending on your Arduino version, the code can be modified for the number of ports.
The Arduino code available here is for the Arduino Nano, a tiny little Arduino that nicely fits next to an EZ-B or IoTiny. It connects to the EZ-B via I2C using its A4 and A5 ports. As you can see from the image below, the I2C ports of the Nano use the A4 and A5 ports. Those ports have to be connected to an EZ-B (whether another Arduino, EZ-B v4, or IoTiny).
The Arduino Nano, for example, has 8 ADC ports. However, 2 of them are used by the I2C connection, limiting you to 6 ADC ports. You can read six servo positions via the Arduino Nano connecting to an EZ-B. Putting this firmware on an Arduino Mega gives you 16 ADC ports, which means reading 16 servo positions. Remember, the I2C address can be modified as well - which means you can have 100+ of these NANOs connected to the I2C and chained together. That gives you 600 ADC ports, HAHA, for whatever reason ;). The Firmware I2C address can be edited and changed. The plugin also has a place to change the I2C address in the configuration.
Here is the firmware for the Arduino: I2C_Analog_Read.zip
Upload that firmware and make any edits as necessary. It is documented quite well, so it should be an easy modification to work with various Arduino boards, such as Mega. I believe the Uno and Nano have similar pinouts but a different number of ADC ports.
The servos connecting to the Arduino's ADC ports must be modified to have a wire attached. That is documented in the video below.