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 skillReceive 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 a 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, which is 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, so that limits you to 6 ADC ports. That means you can read 6 servo positions via the Arduino Nano connecting to an EZ-B. If you put this firmware on an Arduino Mega, that 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 what ever reason ;). The Firmware I2C address can be edited and changed. The plugin also has a place to change the I2C address in 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 that connect to the ADC ports of the Arduino must be modified to have a wire attached to them. That is documented in this video below..
This video has the ADC version of this plugin being demonstrated. You can see what the results would be if you wanted to read servo positions
Related Hack Events
PWM Servo Position Feedback (Read Servo Position)
I'll be hacking a PWM Servo to have positional feedback for EZ-Builder using an EZ-B v4. You can also perform the same...
Robot As Puppet To Control Another Robot By Reading Servo...
In this hack, I'll be showing how to control a robot with another robot as a puppet by reading servo positions....