Pin Connections on the interface board

I wanted to create a board that offered as many different connections as possible. I like to create small robot models and it was really important to offer connections for H-bridges, stepper motors and a whole collection of servos. Sensors are either analogue or digital, and most of them require some sort of power connection.

As a result of all of these decisions, I’ve decided to make the connections based on the pattern set by servo connectors. On these, the centre connection is the positive (+V or Vcc) power supply, one connection is Ground (Gnd) and the final connection is the control signal. On this board, all of the connections face towards the Raspberry Pi Pico.

The pin allocations are based on those given for Microblocks running on the Raspberry Pi Pico at: https://wiki.microblocks.fun/boards/special_pins

Connection diagram for the Raspberry Pi Pico Interface Board
External Pins (Some pins can suit a variety of functions).Used For:
Pins 0-22Digital I/O only (2,3,6,7,8,9 in use for on-board functions)
Pins 0,1Serial UART : Pin 0 – TX Pin 1 – RX
Pins 4,5I2C : Pin 4 – SDA Pin 5 – SCL
Pin 10,11Suitable for an ultrasonic sensor or general I/O use.
Pins 12-19are suitable for servos and have 5v Power Available.
Pins 14-17are also available on the back for connection to a dual H-Bridge for DC motors or Bipolar/Unipolar Stepper Motor driver. A 5V Power Supply is available.
Pins 16-19SPI Pin 16 – SPI MISO Pin 17 – SPI SS Pin 18 – SPI Clock Pin 19 – SPI MOSI
Pins 20-22Digital I/O with 3.3v Power Supply
Pins 26-28Analog or digital inputs with 3.3v Power Supply
Internal Pins
Pin 23(digital output) turn on for better voltage regulation (uses a bit more power)
Pin 24(digital input) detects USB connected
Pin 25(digital output) user LED
Pin 29(analog input) temperature sensor
On-board components
Pin 2 and Pin 3On-board LEDs
Pin 6,7,8,9Tactile Switches
Pin 4,5I2C OLED Display connected to Pin 4 – SDA Pin 5 – SCL and running from 3.3v
Pin Connection List

Advertisement

Fischertechnik, Scratch and Motor Control through the GPIO.

Fischertechnik robot arm connected to two L298 driver boards and controlled through Scratch.

Fischertechnik robot arm connected to two L298 driver boards and controlled through Scratch.

My greatest interest in the Raspberry Pi lies in those 26 little pins tucked down on the side of the board. They just invite things to be connected to them. Having found a pile of dusty Fischertechnik (loosely assembled in a sort-of robot arm shape) in a cupboard, I decided that something could be done with it.
The arm was so dusty it needed disassembling and washing. I left the motors and sensors out of the wash but I figured that everything else would cope. Sure enough, it looked like new again.

I found some L298 motor driver boards on Ebay and these easily connect to the Raspberry Pi GPIO connections. There are four motors in this arm:

  • Rotation of the base
  • Lifting of the “forearm”
  • Lifting the “upper arm”
  • Closing the jaws

Continue reading

Minecraft on the Raspberry Pi

mysnapshot_04Well… I escaped the whole Minecraft phenomenon for this long. Sure, I’d heard about it from the students and a few visitors at the Exeter Raspberry Jam loaded it up on my Pi, but I’d never delved any further.

Minecraft appears to be a game which puts the user in control of “Steve” – a superhero who can hop and fly at the touch of the spacebar. Armed with his trusty sword which can build and tear down (echoes of Ecclesiastes 3) he can navigate the cubic world at will. The world coordinates are limited to +/- 127 units but that’s a fair amount of walking and flying. I’m guessing the scale is somewhere around 1 unit = 1 metre. It’s all vaguely reminiscent of 3d Construction Kit which I used to run on my Amiga. Continue reading

Raspberry Pi with a Glockenspiel

Raspberry Pi and Glockenspiel

This glockenspiel has been converted to play automatically.

I found a glockenspiel in the local recycling centre and decided to have a go at automating it after seeing details on the Raspberry Pi forum and also on the PICAXE website.

It’s quite a straightforward design, using motors to rotate the hammers downwards and then using a rubber band to lift the hammer upwards one the chime has been struck.

Programming this in Python is relatively straightforward – just allocate most of the GPIO outputs to controlling the motors and then trigger them sequentially. The motors are connected to the GPIO outputs using a pair of ULN2803 darlington driver IC’s. It’s quick but as we’ll see, not the best solution.

I haven’t yet found out how to make the software do a clean exit when CTRL-C is pressed – something to do with creating an exception and then using this to shut down the GPIO outputs. Without this, it’s possible to exit while the motors are energised meaning that the peak stall current is passed through the darlington drivers. I’ve had to replace a couple already.

When I design a PCB for this, I think I’ll use a bunch of discrete darlington transistors (BCX38C) along with a current limiting device.

Overall, the sound is pleasant to listen to. I’d like to refine the software and also include the possibility of using RTTTL ringtones. I’ll probably need to filter out sharps/flats and add some kind of a transpose function. Probably a challenge for later!

The bells are ringing in my head.

Sometimes, when things are going smoothly, it’s easy to lose track of time. This is compounded if the school bells aren’t working correctly (Excavator + Buried Cables might have something to do with it). Replacing cables is expensive, disruptive and time-consuming. Here’s where the Raspberry Pi might come in handy – particularly if it has the ability to use “Network Time”.

It’s also a bit of fun. I’ve got an RGB Piranha LED as well as a set of speakers. Ideally, I’d connect up that doorbell sat on my desk so that it sounds more realistic, but the “Ring Ring” spoken by espeak is a better talking and teaching point. Perhaps I should even get the head connected up. In addition, I’ve used figlet to make the time visible, although I’d really recommend running this headless to reduce power consumption.

The LED lights up green in the last 5 minutes of a lesson, and then goes red when the bell should be going. It repeats each message a couple of times to hammer the point home. If I really wanted to use that doorbell, then it’s a simple job to use the PiFace relay where the bell push-switch would be fitted.

Using this program with mplayer or omxplayer might make an interesting clock radio with mp3 files playing instead. Perhaps use mpd to play streaming radio. So many ideas, so little time…

#!/usr/bin/env python
import time, RPi.GPIO as GPIO
import os
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(7, GPIO.IN)
shortDelay = 2
bell_times=["08:45","08:50","09:50","10:50","11:10","12:10","13:10","14:10","14:15","14:30","15:30"]
bell_warning=["09:45","10:45","12:05","13:05","14:05","14:15","14:25","15:25"]
while True:
         GPIO.output(11, GPIO.LOW)
         GPIO.output(12, GPIO.LOW)
         GPIO.output(13, GPIO.LOW)
         current_time=time.strftime("%H:%M")
         print(current_time)
         os.system("figlet "+str(current_time))
         time.sleep(1)
         if current_time in bell_warning:
                 print("Five minute warning for the bell")
                 GPIO.output(11, GPIO.HIGH)
                 os.system('espeak "the bell will go off in five minutes"')
                 time.sleep(20)
                 GPIO.output(11, GPIO.LOW)
                 time.sleep(1)
         if current_time in bell_times:
                 print("Brrrring, Brrrring, Brrrring....")
                 GPIO.output(12, GPIO.HIGH)
                 os.system('espeak "Ring Ring. Ring Ring. Ring Ring"')
                 time.sleep(20)
                 GPIO.output(12, GPIO.LOW)
                 time.sleep(10)