Robot electronics examples
These examples are designed to demonstrate how to use our modules with the Arduino. The Arduino's hardware serial port is not used to connect to our modules, which keeps it available to the USB port. That allows downloading new programs without having to continually disconnect/reconnect things. Most of these examples use the LCD03 display module to show the results, but it is also possible to display the results on the PC, as demonstrated in the CMPS03 example. All the modules which use the I2C bus have 1k8 pull-up resistors to 5v. You only need one set of resistors, located near the Arduino, regardless of however many I2C devices you have connected to it.
The Arduino uses 7bit I2C addresses, and our own documentation uses 8bit addresses. For example our CMPS03 is at address 0xc0, but on the Arduino you will use 0x60. The Arduino address is the same as our address, but shifted right by 1 bit. The binary of 0xC0 is 11000000, the binary of 0x60 is 01100000. The Arduino will shift this left by 1bit and add the Read/Write bit automatically. You can find more information about the I2C bus in our I2C tutorial: Using the I2C Bus.
Index: CMPS03 Magnetic Compass CMPS10 Tilt Compensated Magnetic Compass SRF01 Ultrasonic Ranger SRF02 Ultrasonic Ranger SRF04/05 Ultrasonic Ranger SRF08 Ultrasonic Ranger SRF10 Ultrasonic Ranger SRF485WPR Ultrasonic Ranger SRF235 Ultrasonic Ranger TPA81 8 Pixel Thermal Sensor SD20 Servo Controller SD21 Servo Controller MD03 24V 20A Motor Driver MD22 Dual 24V 5A Motor Driver MD25 I2C RD02 Motor Driver MD25 Serial RD02 Motor Driver MD49 24v EMG49 Motor Driver RLY08 Relay Module
Contents
- CMPS03 Magnetic Compass
- CMPS10 Tilt Compensated Magnetic Compass
- SRF01 Ultrasonic Ranger
- SRF02, SRF08, SRF10, SRF235 Ultrasonic Rangers
- SRF485WPR Ultrasonic Ranger
- SRF04 and SRF05 Ultrasonic Ranger
- TPA81 Thermal Sensor
- SD20 Servo Controller
- SD21 Servo Controller
- MD03 24V 20A Motor Driver
- MD22 24V 5A Motor Driver
- MD25 RD02 Motor Controller I2C
- MD25 RD02 Motor Controller Serial
- MD49 24v EMG49 Motor Driver
- RLY08 Relay Module
CMPS03 Magnetic Compass
This uses the I2C bus to connect the Arduino to the CMPS03. It reads the bearing as a two byte integer and displays the bearing as a number 0-359 on the PC.
Download the arduino-cmps03-a.zip file.
CMPS10 Tilt Compensated Magnetic Compass
This uses the I2C bus to connect the Arduino to the CMPS10. It reads the bearing as a two byte integer and displays the bearing as a number 0-359 on the LCD03 display.
Download the arduino-cmps10-a.zip file.
SRF01 Ultrasonic Ranger
The SRF01 uses a single pin for both serial input and output. By using a software serial port, we can make the Arduino do serial input and output on a single pin as well. You can have up to 16 SRF01's connected to a single pin on the Arduino. The Range is displayed on an LCD03 module.
Download the arduino-srf01-a.zip file.
SRF02, SRF08, SRF10, SRF235 Ultrasonic Rangers
The SRF02, SRF08, SRF10 and SRF235 all use the same I2C interface. The basic ranging commands are the same, so this example works for all these rangers.
Download the arduino-srf08-a.zip file.
SRF485WPR Ultrasonic Ranger
Using an ST485 for communication this example finds the address of an SRF485 and reads the range back from it.
Download the arduino-srf485wpr-a.zip file.
SRF04 and SRF05 Ultrasonic Ranger
This example reads the range from the SRF04 and displays it in the arduino serial monitor. This example will also work for the SRF05.
Download the arduino-srf04-a.zip file.
TPA81 Thermal Sensor
The TPA81 connects to the Arduino using the I2C bus. This example displays the ambient temperature and 8 temperatures from thermal sensor, on an LCD03 module.
Download the arduino-tpa81-a.zip file.
SD20 Servo Controller
Although the Arduino is capable of outputting servo pulses, it places restrictions on your software and uses up a lot of valuable I/O pins. By using the SD20 chip, you can control up to 20 servo's.
Download the arduino-sd20-a.zip file.
SD21 Servo Controller
The SD21 is a ready wired module which can save a lot of time compared to the SD20 above. This example moves a servo through its maximum range.
Download the arduino-sd21-a.zip file.
MD03 24V 20A Motor Driver
This example runs the motor forwards and backwards, displaying the temperature and motor current on the LCD03.
Download the arduino-md03-a.zip file.
MD22 24V 5A Motor Driver
This example runs the motors forwards and backwards. The LCD03 is only used to display the software version number.
Download the arduino-md22-a.zip file.
MD25 RD02 Motor Controller I2C
This example uses the I2C bus to drive the RD02 motors to back and forth between 2 encoder values. The Encoder count is displayed on the LCD03, as well as the battery voltage.
Download the arduino-md25-i2c-a.zip file.
MD25 RD02 Motor Controller Serial
This example drives the RD02 motors to back and forth between 2 encoder values. The Encoder count is displayed on the LCD03, as well as the battery voltage.
Download the arduino-md25-serial-a.zip file.
MD49 24v EMG49 Motor Driver
This example drives the MD49 motors displaying the encoder values, battery voltage, motor currents and error byte on an LCD03.
Download the arduino-md49-a.zip file.
RLY08 Relay Module
A simple example. Just switches one of the eight relays on/off.
Download the arduino-rly08-a.zip file.
More information
- Robot electronics examples
- Using the I2C Bus
- Robot shield for Arduino