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


  1. CMPS03 Magnetic Compass
  2. CMPS10 Tilt Compensated Magnetic Compass
  3. SRF01 Ultrasonic Ranger
  4. SRF02, SRF08, SRF10, SRF235 Ultrasonic Rangers
  5. SRF485WPR Ultrasonic Ranger
  6. SRF04 and SRF05 Ultrasonic Ranger
  7. TPA81 Thermal Sensor
  8. SD20 Servo Controller
  9. SD21 Servo Controller
  10. MD03 24V 20A Motor Driver
  11. MD22 24V 5A Motor Driver
  12. MD25 RD02 Motor Controller I2C
  13. MD25 RD02 Motor Controller Serial
  14. MD49 24v EMG49 Motor Driver
  15. 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.

arduino cmps03
Figure 1 - Arduino CMPS03

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.

arduino cmps10
Figure 2 - Arduino CMPS10

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.

arduino srf01
Figure 3 - Arduino SRF01

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.

arduino srf08
Figure 4 - Arduino SRF08

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.

arduino srf485wpr
Figure 5 - Arduino SRF485WPR

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.

arduino srf04
Figure 6 - Arduino SRF04

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.

arduino tpa81
Figure 7 - Arduino TPA81

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.

arduino sd20
Figure 8 - Arduino SD20

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.

arduino sd21
Figure 9 - Arduino-SD21

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.

arduino md03
Figure 10 - Arduino MD03

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.

arduino md22
Figure 11 - Arduino MD22

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.

arduino md25 i2c
Figure 12 - Arduino MD25 I2C

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.

arduino md25 serial
Figure 13 - Arduino MD25

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.

arduino md49
Figure 14 - Arduino MD49

Download the arduino-md49-a.zip file.

RLY08 Relay Module


A simple example. Just switches one of the eight relays on/off.

arduino rly08
Figure 15 - Arduino RLY08

Download the arduino-rly08-a.zip file.

More information