Arduino 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 CMPS02 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.

Index:
CMPS03 Magnetic Compass
SRF01 Ultrasonic Ranger
SRF02 Ultrasonic Ranger
SRF04 Ultrasonic Ranger
SRF05 Ultrasonic Ranger
SRF08 Ultrasonic Ranger
SRF10 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
MD23 RD01 Motor Driver
RLY08 Relay Module
LCD03 I2C LCD display 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 CMPS03I2C.PDE file

Back to Index


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 SRF01.PDE file

Back to Index


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 SRF08.PDE  file

Back to Index


SRF04 Ultrasonic Ranger
To work with the Arduino, the SRF04 requires its timing pin (marked "do not connect" on the tech page) connected to ground, as shown below. 

Download the SRF04.PDE  file

Back to Index


SRF05 Ultrasonic Ranger
This example uses the SRF05 in one pin mode, where the Trigger and Echo signals appear on the same pin. Note the SRF05's mode pin is connected to ground to place it in one pin mode.

Download the SRF05.PDE  file

Back to Index


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 TPA81.PDE file

Back to Index


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 SD20.PDE file

Back to Index


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 SD21.PDE  file

Back to Index


MD03 24V 20A Motor Driver
This example runs the motor forwards and backwards, displaying the temperature and motor current on the LCD03.

Download the MD03.PDE file

Back to Index


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 MD22.PDE file

Back to Index


MD23 RD01 Motor Controller
This example drives the RD01 motors to and encoder count of 5000, then back to zero. The Encoder count is displayed on the LCD03, as well as the battery voltage.

Download the MD23.PDE file

Back to Index


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

Download the RLY08.PDE file

Back to Index


LCD03 I2C LCD Display Module
The SRF02, SRF08, SRF10 and SRF235 all use the same I2C interface. This example is similar to our SRF02, SRF08, SRF10 and SRF235 examples above, except that it uses the LCD03 in I2C mode instead of serial. Make sure you have the link on the LCD03 module to the I2C position. This example makes use of a new I2C library by Dale Wentz, which can be downloaded from the Arduino playground at:
http://www.arduino.cc/playground/Code/LCDi2c

 

Download the LCD03.PDE file

Back to Index