Controlling a robot arm with the Pi and Scratch GPIO

This demonstration uses Scratch GPIO developed by Simon Walters at Cymplecy. The robot can be purchased for about £25 – £30 such as through Rapid. It’s not too difficult to build – but you need to keep the wires separate so you can wire them up.

5 motors needs 15 GPIO pins. Each motor needs 2 motor direction controls and a power control. I wired them up to some H bridges and connected them to the Pi. Scratch GPIO can give a lot of outputs.

Once connected, it’s a simple case of altering  motor directions and turning power on and off. With time, you could program complex manouvres.

Using an 8 x 8 LED matrix with an Arduino

This was fun. The matrix has  8 x 8 LEDS. They get turned on and off by selecting the column pin and row pin HIGH or LOW.

This is an example of what you can do.

 

So how is this done.

The matrix has 12 pins going across at the top and 12 pins at the bottom. After some playing around, this is how it works

It’s to do with the 3 times table (and the 8 times table)

Rows

  • Row 1 controlled by pin 3
  • Row 2 controlled by pin 6
  • Row 3 controlled by pin 9
  • Row 4 controlled by pin 12
  • Row 5  controlled by pin 15
  • Row 6  controlled by pin 18
  • Row 7  controlled by pin 21
  • Row 8 controlled by pin 24

If you turn a row ON (HIGH), the LEDS have power.

The LEDs come in green and red,

  • Column 1 controlled by pin 1 / 2 (green is 1, red is 2)
  • Column 2  controlled by pin 4 / 5 (green is 4, red is 5)
  • Column 3  controlled by pin 7 / 8 (green is 7, red is 8)
  • Column 4 controlled by pin 10  / 11 (green is 10, red is 11)
  • Column 5 controlled by pin 13  / 14  (green is 13, red is 14)
  • Column 6  controlled by pin 16  / 17  (green is 17, red is 8)
  • Column 7 controlled by pin 19 / 20 (green is 19, red is 20)
  • Column 8  controlled by pin 22 / 23 (green is 22, red is 23)

If a column pin is LOW, the LED turns ON.

So to get number 12 to light up GREEN , it’s in Row 2, Column 4 so we have Pin 6 HIGH, Pin 10 (LOW)

If we want 21 to light up at the same time, it’s in Row 3, Column 5 so we have Pin 9 HIGH pin 13 LOW. But Because row 2 and column 4 are also ON, that will light up more than we need. So we need a delay in the circuit.

I’m going to add some diagrams to explain this. The code is here.