Using 4tronix Add-On Boards with Raspberry Pi Model B+

Model B+ Raspberry Pi Mounting Issues

14th July 2014

Click on any image to enlarge

bplus_compare

With the introduction today of the new Model B+ it is important to take note of the physical differences as well as the functional changes that have been made.

Purchase from here

The physical differences mean that some add-on boards and most (all?) existing cases cannot be used with the new Model B+

To see why this may be, let’s enumerate some of the various physical changes

  1. Both boards are the same nominal size at 56 x 86mm
  2. B+ has slightly rounded corners
  3. The Rev 2 mounting holes have been removed
  4. New 4 mounting holes (2.5mm diameter) are provided, 3.5mm from the edges. 2 are in the left corners and the other 2 are just to the left of the USB and Ethernet sockets
  5. The GPIO connector is now 40 ways, with the first 26 pins being identical to the existing Model B so add-on boards can plug into just the first 26-pins
  6. The GPIO connector has moved away from the left hand edge by about 6mm, to allow for the corner mounting hole
  7. The USB connectors (2 of them now) have moved inboard so they protrude much less. The rear of them is still less intrusive than the Ethernet socket, but many existing add-on boards will collide with the new positions
  8. Many smaller add-on boards relied on capacitor C2 to provide a support, by using a rubber bumper/foot on the bottom of the add-on board. C2 is no longer present
  9. The composite video and audio connectors have been removed and replaced a a single low-profile, slimline socket which has been squeezed in between the camera socket and the ethernet connector
  10. The micro-USB connector has moved around the corner and turned 90 degrees
  11. Activity and power LEDs have moved to near pin 1 of the GPIO connector (and now are edge-lit)
  12. The Ethernet LEDs have moved onto the ethernet connector itself.

 

The diagram below shows the placement of the various items on both boards that could affect the fit and placement of add-on boards with the red line showing a possible shape of PCB that would be compatible with both Model B and Model B+. Download a dimensional drawing from here. Note especially that you should bring the board outline in, immediately after pins 25 and 26 on the GPIO socket, so allowing access to the remaining 14 pins on the new connector.

outline02a

 

Existing 4tronix Add-On Boards

PiRoCon 1.2

As this board used the full area around the composite video socket and inside the USB and Ethernet sockets, it doesn’t fit directly onto the Model B+. However, it is simple to attach an extending GPIO header and an additional 12mm spacer so that the board can be used perfectly well on a Model B+

PiroconB+01 PiroconB+02

Although the support pillar cannot be screwed into the non-existent mounting hole on the Model B+, they have at least left this part of the board clear, so there is no problem with the support pillar resting on the Raspberry Pi. It is imperative that you use the support pillar for this larger board. When purchasing a PiRoCon, you can specify “B+ Mounting Kit” and receive the extended header and 12mm male-female spacer for an additional £0.50 +VAT.

 

MicRoCon and Pi-Step

Whilst these can be fitted directly to the Model B+, they both used the rubber bumper on to the capacitor C2 to support them. There is no equivalent support position on the B+, so they have to be left unsupported, which is not a big problem especially if the connections are made before plugging in. I would recommend that the rubber bumper be moved over the HDMI scoket (as shown in the second photo below), so it prevents any possibility of shorting out if the board is bent over a long way

microconB+01 microconB+02

 

PiDie and PiRingo

The PiDie board “just” fits inside the Ethernet socket on the B+, as you can see from the photo below. The PiRingo fits without any problems. The support pillars for both boards can be used as it touches part of the Raspberry Pi board with no components, but of course it can no longer be screwed into the Pi.

pidieB+02

 

IP Display Dongle and Adapter

There is no problem with this as it plugs directly onto the end of the GPIO connector. No changes required.

ipdisplayB+01

 

Initio Robot Chassis

The ABS moulding of course does not contain mounting holes for the new Model B+, but it can easily be adapted to fit using one of the offset spacers provided in every kit. There are several ways to fit the B+ onto the chassis, but the recommended position below allows the board to be supported in 4 corners, 2 of which have a screw in place. As with all boards mounted onto the chassis, you should remove the mounting positions that are not required so they don’t damage any components on the bottom of the Raspberry Pi board

initioB+01

 

IP Display Dongle

IP Display Dongle – Usage & Software

(Click on any image to enlarge)

ipd03

The IPDisp V1 is a 4-digit 7-segment LED display utilising a “retro” LED of the type found in 1970s calculators. This makes for a cute little display device that can be used to display anything you like that will fit in a 7-segment display. V2 uses a standard 7-segment display which is slightly larger. Both PCBs are the same size: 40 x 32mm (width x height).

 

You can purchase it here at 4tronix.

 

It was conceived as a device to help roboteers find the IP address of their robot so that they can connect to it via SSH or VNC for control purposes. Of course you can use a network scanner such as the excellent Fing, but that can become unwieldy in a corporate or educational establishment with a lot of connected devices. This unit is much more fun and can be setup to display the IP address directly on boot up.

 

IPDisp uses an I2C Port expander chip, the MCP23017, to address all the segments (anodes) as well as the individual common cathode digit drivers. The provided software, in Python, time-multiplexes the digits so that each digit is displayed for only 25% of the time.

 

Connecting the IP Display Dongle

The pinout is designed to match the I2C expansion socket on every 4tronix robotics controller board: PiRoCon, MicRoCon, Pi2Go and PGX. Simple select the type of header you want to use and solder it on. You may want it to lie flat, stand vertical, lie flat but higher up (extended header), etc. Then, making sure that you have it correct way round, plug it directly into the I2C expansion header. Here we show it plugged vertically into the I2C expansion connector on a MicRoCon controller board.

ipd01a

We also include female headers in the package, so you can plug into a male header, or use male-ended jumper wires to connect to your I2C pins. In fact, apart from the 5V connection, the layout of the pins matches the standard GPIO header on the Raspberry Pi, pins 1, 3, 5 and 7. So plug the header in to the pins as shown below, with the 5V pin hanging off the end. You then have 2 choices:

  1. Use a male-female jumper wire to connect the 5V on the IPDisp to Pin 2 on the GPIO header
  2. Solder across the last 2 pins (5V and “not connected”). This powers the IPDisp off the 3.3V from the Raspberry Pi. Although it “works”, it is not recommended except frr emergencies as it does use too much power for continuous use.

ipd02 Option 1

ipd04Option 2

 

Running the Software

Make sure that you have the I2C drivers enabled on your SD card. If not, follow this post by Raspi.TV

Download the python sample file and run it using sudo python ipd03.py:
$ cd ~
$ mkdir ipd
$ cd ipd
$ wget http://4tronix.co.uk/ipd/ipd03.py
$ sudo python ipd03.py

This will display the IP address and scroll it across the display a number of times, before quitting. If the Pi is not connected to a network, then it will display 0-0-0-0 and wait until the network is connected before displaying the correct IP address. As the continuous updating of the display is processor intensive, we don’t leave it running permanently.

The current version of the software will exit with an exception if the IPDisp is not connected. We didn’t bother to catch the exception as the information is what we need anyway.

Of course, this is not a lot of use  like this because we must already be connected, or running locally when running the application like this. It is much more useful to get the program to autostart when the Pi boots up. To do that follow the instructions to instigate a startup program when the desktop starts. (you can also put the code in the startup list, but we’ll do it like this for now)

Open LXterminal

$ cd ~    (back to home directory)
$ cd .config
$ mkdir autostart   (not required if it already exists)
$ cd autostart
$ sudo nano ipd.desktop

…and enter the following lines. Note that the Exec line needs to have the correct location for where you have put the program.

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=IPDisplay
Exec=sudo python /home/pi/ipd/ipd03.py
StartupNotify=false
Terminal=false
Hidden=false

Exit (ctrl-x) and save (y) then reboot. The IPDisplay will show the IP address of the Pi.

 

 

Converting Initio Robot Platform to Stepper Motors

Initio Robot Platform with Stepper Motors

(Click on any image to enlarge)

tm03

The Initio robot was designed to be able to use stepper motors as an option instead of the DC motors. It is fairly easy to put the motors in, but slightly trickier for the control of them.

 

The following instructions are mainly photo based, with only a few comments…

Starting Position

step01

 

Loosen the inner 2 screws on the inside of one Gearbox

step02

 

Remove the 2 outer screws to release the gearbox

step03

step04

step05

 

NB. It is not necessary to remove the DC motor, but I show it here for completeness

Carefully unclip the motor. This probably requires 2 people: 1 to pull the motor out and one to hold back the retaining clips

step06

 

Unscrew the wheel sensor from the gearbox. Keep the screws as we’ll use them to attach one of the stepper motors.

step07 step08

 

Slide the switch on top of the gearbox (one above each wheel) to the inside. this allows the wheel to rotate freely without turning the gears. It also means the stepper motor is mechanically disconnected from the DC motor so it is free to rotate.

step09 step10

 

Fit the stepper motor, ensuring that the shaft lines up with the retaining hole in the gearbox. Use the 2 screws that previously held the wheel sensor for one stepper motor. The other stepper motor will require 2 screws of the same size from the Initio pack of screws

step11 step12 step13

 

Repeat for all 4 stepper motors and replace the gearboxes, bringing the cables up to the top of the chassis mounting plate

step14 step15

 

Prepare the ULN2003 boards for connecting 2 stepper motors to each board. If you purchased your stepper motors including boards, then you can remove the JST sockets from one board for each side of the Initio and use that as shown below. Otherwise you will need to purchase the correct JST sockets. We use a single controller board for both stepper motors on one side of the Initio, and solder the extra socket over the pins on the underside of the board as shown in the photos below.

step16

 

Bend over the pins at 90 degrees (away from the side with the slots in). Then solder to the underside of the board

step17 step18 step19

 

You can then screw the control boards into any available mounting pillars – one screw per board will keep it in place.

step20

 

Next step: writing some code…

Pizazz – Sample programs in Python and ScratchGPIO

Python Example Scripts

Please note that these programs are provided “as is” and without warranty purely for the purpose of demonstrating how you can write your own code for this robotic vehicle.

If you have our SD card with ready-installed demos, you will find these programs in home/pi/Pizazz/

If not then from a terminal window (eg. LXTerminal) type or cut&paste the following to install:

wget http://4tronix.co.uk/pizazz.sh -O pizazz.sh

bash pizazz.sh

  • motorTest.py  Tests the motors by moving Forwards, Reverse, SpinRight, SpinLeft, Pause in a loop. Press Ctrl-C to exit. This program will also light the LEDs to show the direction it is moving. Two LEDs at the front for Forwards, 2 LEDs at Left for Spin Left, etc
  • ledTest.py  Simply tests the LEDs by cycling LED1, then LED2, then LED3 then LED4 then back to LED1 again. Press Ctrl-C to stop
  • sonarTest.py  Prints the distance from the ultrasonic sensor to the nearest reflective obstacle. Repeats every second. Press Ctrlc-C to stop
  • standardLF.py  This is a standard Line Follower algorithm (thanks to Zachary Igielman). Place a black line (eg. electrical insulation tape) onto a reflective surface and the Pizazz will check if either sensor hits the line. If, say, the left sensor touches the line, then the Pizazz will spin left until the sensor is no longer on the line, then it will start moving again. You may need to adjust the separation of the sensors, and/or the speed of the robot to follow your specific line
  • fuzzyLF.py  This line follower is a bistable line follower. It is always (after it has found the line) either turning left or turning right. If it hits a line with the left sensor then it know it needs to turn left to find the line again, so it keeps moving left until the right sensor detects a line, then it starts moving right. This has the strange effect of the Pizazz wandering around close to the line, but not necessarily sitting directly over it. It does mean the that the speeds can be increased and it is easy to make the Pizazz go around a track twice as fast as with a standard line follower. You probably will need to move the line follower sensors much closer together than for the standard line follower program

 

ScratchGPIO Example Scripts

Please note that these programs are provided “as is” and without warranty purely for the purpose of demonstrating how you can write your own code for this robotic vehicle.

If you have our SD card with read-installed demos, you will find these scripts by doing a File / Open within Scratch and selecting the Pizazz folder

Many thanks to Simon Walters (@cymplecy) for all his excellent work on this

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