Programming the Pizazz – Which Pins do What

pz01

Pizazz – A Robot Vehicle for your Pi, Complete with Sensors and Optional WiFi

Allocation of GPIO Pins

The following list of pin numbers assumes that you have exactly followed the wiring instructions here

For ease of use with ScratchGPIO all pins are specified as the physical pins on the GPIO header. In brackets, we put the standard Broadcom use of these pins

  • Left Motor: 24 (CE0), 26 (CE1). To move forwards set 26 to High and 24 to Low. (NB it is better to use PWM to get some speed control)
  • Right Motor: 19 (MOSI), 21 (MISO). To move forwards set 19 to High and 21 to Low. (NB it is better to use PWM to get some speed control)
  • LED1: 22 (GPIO25). Set Low to turn On, set to High to turn Off
  • LED2: 18 (GPIO24). Set Low to turn On, set to High to turn Off
  • LED3: 11 (GPIO17). Set Low to turn On, set to High to turn Off
  • LED4: 07 (GPIO04). Set Low to turn On, set to High to turn Off
  • UltraSonic: 08 (TXD). Set to an Output to send a 10µs pulse, then set to an Input to measure the return pulse
  • Left Line Follower: 13. This will be Low (0) for White (reflective) surface, and High (1) for Black (non-reflective) surface
  • Right Line Follower: 12. This will be Low (0) for White (reflective) surface, and High (1) for Black (non-reflective) surface

 

Using Batteries for the Pizazz

  • Although all other parts of the Pizazz will operate purely from 5V supplied to the USB connector on your Pi, you will need to connect the battery pack to the MicRoCon and switch it on, before the motors will operate
  • You should only use good quality rechargeable batteries that can provide at least 1A continuously. We strongly recommend Energizer Extreme rechargeables of at least 2000mAh
  • the MicRoCon has a voltage regulator which will happily and safely power your Pi as long as the battery voltage remains above 6V or so
  • If the batteries are getting low, you should safely turn off the Pi, then remove and recharge the batteries
  • You can also power the Pi and the motors from separate power sources if required. Unsolder the solder jumper on the MicRoCon (near the regulator) labelled PWR, then you can power the Pi by plugging in a USB power bank or similar into the the USB socket on the Pi – NB. You will still need to connect batteries for the motors to operate

 

Using the Motors

  • Each motor is driven by 2 separate GPIO lines
  • To make the motor move, one of these lines needs to be High and the Other needs to be Low
  • If they are both the same (either both High, or both Low) then the motor will not turn
  • To move the Pizazz forwards in a straight line: Set 19 and 26 High, and set 21 and 24 Low
  • To move the Pizazz backwards in a straight line: Set 19 and 26 Low, and set 21 and 24 High
  • To Spin Left on the spot, make the Left Motor move backwards and the Right motor move forwards: Set 26 Low, 24 High and set 19 High, 21 Low

 

ScratchGPIO Examples

You will require ScratchGPIO version 5.1.26 or later, and see here for tutorial examples

PizaaaDocs