Picaxe Examples

These examples are designed to demonstrate how to use our modules with the Picaxe. 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 PicAxe, regardless of however many I2C devices you have connected to it.

Not shown on the schematics, you should fit a 100nF capacitor between the 5v supply and ground (0v). This should be located as close to the Picaxe chip as possible.

Index:
CMPS03 Magnetic Compass
CMPS09 Tilt Compensated 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
MD49 Dual 24V 5A Motor Driver
RLY08 Relay Module

CMPS03 Magnetic Compass
This uses the I2C bus to connect the Picaxe to the CMPS03. It reads the single byte bearing and displays the bearing as a number 0-255 on the PC.

Download the CMPS03PICAXE.BAS file

Back to Index


CMPS09 Tilt Compensated Magnetic Compass
This uses the I2C bus to connect the Picaxe to the CMPS09. It reads the single byte bearing and displays the bearing as a number 0-255 on the PC.


Download the CMPS09PICAXE.BAS file

Back to Index


SRF01 Ultrasonic Ranger
The SRF01 uses a single pin for both serial input and output, however because the Picaxe uses separate pins for input and output, we still need two PicAxe pins. A schottky diode, such as a BAT85, is used to prevent the SRF01 driving the Picaxe's output. You can have up to 16 SRF01's connected to the PicAxe. The Range is displayed in a debug window on the PC.

Download the SRF01PICAXE.BAS 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 SRF02PICAXE.BAS  file

Back to Index


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

Download the SRF045PICAXE.BAS  file

Back to Index


SRF05 Ultrasonic Ranger
As the PicAxe uses separate pins for input and output, the SRF05's one pin mode is not usable on the PicAxe. This example uses the SRF05 in two pin mode, where the Trigger and Echo signals appear on the same pin. Note the SRF05's mode pin is unconnected to place it in two pin mode. The software for the SRF05 is identical to the SRF04 example above.

Download the SRF045PICAXE.BAS  file

Back to Index


TPA81 Thermal Sensor
The TPA81 connects to the Picaxe using the I2C bus. This example displays the ambient temperature and 8 temperatures from thermal sensor, on an LCD03 module.

Download the TPA81PICAXE.BAS file

Back to Index


SD20 Servo Controller
Although the Picaxe 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 SD20PICAXE.BAS 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, and the Picaxe fit on a socket on the SD21. This example moves a servo through its maximum range.

Download the SD21PICAXE.BAS  file

Back to Index


MD03 24V 20A Motor Driver
This example runs the motor forwards and backwards.

Download the MD03PICAXE.BAS file

Back to Index


MD22 24V 5A Motor Driver
This example runs the motors forwards and backwards. 

Download the MD22PICAXE.BAS file

Back to Index


MD49 24V 5A Motor Driver
This example runs the motors between 2 different encoder counts. 

Download the MD49PICAXE.BAS file

Back to Index


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

Download the RLY08PICAXE.BAS file

Back to Index