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

 

Pizazz Low Cost Robotic Vehicle for Raspberry Pi

pz01

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

Specification

All true robots need some form of input sensors and outputs as well as motors, so we have created this ultra-cheap but full featured robot for your Raspberry Pi. Just look at some of the features:

  • Crystal Clear Pizazz chassis in 3mm acrylic plate
  • 2 pre-wired 48:1 geared motors, complete with noise suppression capacitors
  • No soldering, glueing or adhesive pads etc. All items simply plug or screw together
  • Fully assembled MicRoCon2 controller board – Optional Extended Header if required (select during purchase)
  • Low drop out voltage regulator to safely power your Pi and keep the power separate from the motors. No requirement for two separate battery packs
  • Custom designed 4tronix ultrasonic and LED PCB for easy fitting of the ultrasonic distance sensor and provide 4  individually controllable output LEDs
  • LEDs can be driven directly using Python or ScratchGPIO commands
  • InfraRed line sensors with adjustable positions
  • Wifi dongle (optional)
  • 6-cell battery holder
  • On-Off switch
  • All the wires, screws and mountings required
  • We also offer an optional SD card pre-loaded with ScratchGPIO, VNC, Python and example files in Pyhon and ScratchGPIO so you can get going straight-away
  • All you need to provide is the Raspberry Pi and the batteries

Links to Get you Started