Saturday, April 1, 2017

Introducing the MonkMakesDuino

Yet another Arduino clone, but his time a bit different in that is is designed with education and breadboard use as its main goal.

Its on KICKSTARTER now, so take a look if you are interested.
The main features are:
  • Breadboard friendly - clearly labelled pins
  • Arduino Uno compatible (Board Type: Arduino Uno in the Arduino IDE)
  • Low-cost simple design
  • Built in USB interface with high quality drivers available (CP2102)
  • Polyfuse over-current protection
  • 5V USB powered
  • Buffered 'L' LED on pin 13
You get the same pins as the Arduino Uno (more or less) but in a single line that fits over one edge of the breadboard, leaving the rest of the breadboard free for your project.

Friday, March 24, 2017

Logging Multimeter Readings with a Digitek DT-4000ZC on a Mac

I bought one of these multimeters a few months ago on eBay, to be able to automate the timed taking of readings using a multimeter.

Given the price, I wasn't expecting much, but it works pretty well.

Being a Mac user, I am used to either using software in a Windows XP virtual machine, or searching out alternative software for a device. I this case, I found that a Python library has already been written to decode the multimeter's strange display-based protocol. The protocol actually transmits the state of each of the segments on the display - an interesting problem to code.

To get this going, you will need to:

  1. Install Python on my Mac 
  2. Download the TP4000ZC library
  3. Unzip it and then in the directory containing the library python files you just downloaded, create a new file called 'dmm.py' and paste the following code into it:

import tp4000zc
import time
port = '/dev/tty.wch ch341 USB=>RS232 1420'

dmm = tp4000zc.Dmm(port)

last_time = 0
period = 1.0

  while True:
    val = dmm.read()
    t = time.time()
    if t > last_time + period:
      last_time = t
      value = val.numericVal

The multimeter is supplied with an RS232 interface, so I bought a cheap USB to RS232 adapter. You may need to install drivers for this, and then you have to work out what the device name is and modify the line of dmm.py that starts 'port =' to match the device name for your USB adapter.

Run the program, and readings will start to appear.

MacBook:tp4000_dmm si$ sudo python dmm.py 


To draw charts and analyze the data, just select the readings from the terminal and then paste them into a spreadsheet.

Thursday, March 23, 2017

Raspberry Pi 2 vs 3 Current Consumption During Boot

I just wanted to share this fairly uninteresting result in case its useful to anyone.

I measured the current drawn from a 5V power supply on both a Raspberry Pi 2 (with Realtek WiFi dongle) and a Raspberry Pi 3 (with built in WiFi) to get an idea of the current consumption while these two boards booted up.

So, with no further ado, here are the results.

Rather as expected - much the same, both settling down to an 'idle current' of around 300mA, booting in under 30 seconds.

In answer to MrMobileWill, to take the readings, I used the following setup.

I sacrificed a micro USB lead, stripping the wires to get the black and red power wires. I then put my multimeter in current mode in series between my bench power supply (set to 5V) and the Raspberry Pi.

This multimeter has an RS232 serial interface that I connected to my Mac using a USB to serial interface (cheap off eBay).

The software setup is a little complicated. So See my next post for details on how I did this.

Sunday, January 22, 2017

On Switch for Raspberry Pi

When you gave finished using your Raspberry Pi, you should really shut it down, otherwise, its possible to corrupt the SD card image which would mean you having to reinstall Raspbian. Having shut-down your Raspberry Pi you can get it to boot up again by unplugging and plugging the USB lead, but a neater solution is to add a reset button to your Raspberry Pi.

Most models of Raspberry Pi have a connector just for this purpose.


You will Need

* 2 pin header
* A push button with female header connectors.

For the push button, you can either use a scavenged reset switch from an old PC, or, as I have here, a MonkMakes Button, which is sold as a twin-pack on Amazon.com or Amazon.co.uk.


First of all, you need to identify the two holes in your Raspberry Pi board that you need to make connections to. These are circled in yellow in the figures below, for the Raspberry Pi models that I have. The location of this has moved with pretty much every Raspberry Pi release. The two pins will either be labelled RUN or P6

Raspberry Pi 3 model B

Raspberry Pi 2 model B

Raspberry Pi model B ver 2

Raspberry Pi Zero

Raspberry Pi A+

Having found where the pin headers need to go, if you have soldering equipment, then solder the pin header into the socket as shown here:

If you want to avoid soldering, then you can do so as follows. First push the plastic part of the header pin down as shown below:

Then push the header pin through from the underside of the board and push the header sockets of the MonkMakes Button into the header pins so that the Pi is the filling in a header sandwich. As long as the switch is not moved around too much, it should stay connected and make a reasonable contact, but soldering is better if you can.

Shutting Down and Starting

To test out your modification, power up your Raspberry Pi and then shut it down, by selecting Shutdown from the raspberry menu.

Then select the option Shutdown.

After a while the screen will close down and the Pi will go into a 'halt' mode, where it uses minimal power and is basically in standby mode.

Now to start your Pi, all you need to do is press the button and it will start to boot up!

If you liked this article, you will probably like my Raspberry Pi books:


Wednesday, August 31, 2016

Introducing the Joey Raspberry Pi Display

Gooligum Electronics (could they be more Australian?) recently sent me a Joey board to play with.

These boards are incredibly good value at $8 (the American sort of dollar) and a neat design that uses offset holes in the PCB so that it will slide over your Raspberry Pi's GPIO connector while leaving you access to the pins for other uses. This works well, with just the right amount of offset to ensure a good connection without bending the pins.

To make use of the Joey, you'll need to go and get the Python library for it.

Install it using the command:

git clone https://github.com/gooligumelec/Joey-support-Python-code.git

The Joey board also uses I2C so you will need to enable I2C which you can do from the Preferences->Raspberyy Pi Configuration menu option.

You'll also need to install smbus using the commands:

sudo apt-get install python-smbus

I tried out one of the example programs inside the folder joey_clock.py

cd Joey-support-Python-code
sudo python joey_clock.py

The Joey also has a row of three jumpers on the front that you can attach buttons to. Just the job for a Squid Button!

I added the Squid Button so that the clock could switch between showing the hours:mins or seconds. The modified program is listen below:

import time
import datetime
from joey_support import joeyBoard

display = joeyBoard()

show_seconds = False

# Continually update the time on the "Joey" 4 char, 7-segment display
  if display.getJumpers() == 7:
      show_seconds = not show_seconds
  now = datetime.datetime.now()
  hour = now.hour
  minute = now.minute
  second = now.second
  if show_seconds:
      display.writeDigit(3, int(second / 10))   # Tens
      display.writeDigit(4, second % 10)        # Ones
      # Set hours
      display.writeDigit(1, int(hour / 10))     # Tens
      display.writeDigit(2, hour % 10)          # Ones
      # Set minutes
      display.writeDigit(3, int(minute / 10))   # Tens
      display.writeDigit(4, minute % 10)        # Ones
  # Toggle colon
  display.setColon(second % 2)              # Toggle colon at 1 Hz
  # Wait one second

Monday, August 8, 2016

Use a Raspberry Squid with a Micro:bit

The Raspberry Squid is an RGB LED with built-in resistors originally designed for the Raspberry Pi. But you can also use it with a BBC Micro:bit.

You can find instructions for making a Squid from https://github.com/simonmonk/squid or buy a ready-made one by MonkMakes.

You will also need a Micro:bit and a breakout board such as this one from Kitronik.

Connect up the Squid with the black lead to 0V, red to pin0, green to pin1 and blue to pin2.

Here's the script!

Friday, February 5, 2016

A Simple LED Clock using Spark Core or Particle Photon

Having a spare Spark Core doing nothing, it struck me that it would be very easy to pair it up with a large 4 digit 7 segment I2C Adafruit display that I had and make a clock. What's more, because the Spark Core is connected to the Internet via my home network it can get its time from a time server and always be accurate.


To make this build, you will need:

  • A Particle Photon or Spark Core
  • I2C backpack LED display (Adafruit product ID 878 or 1270)
  • Half breadboard
  • 2 x 4.7k resistors
  • 5 x male to male jumper wires
I used Adafruit's large display (1270) which has an extra pin to the left of the + pin that supplies power for the control logic, separate to the LED power. The breadboard layout below will work for the large display and the smaller display, just make sure that whichever display you use, the yellow lead goes to the C connection of the display.

The displays are also available in other colors if you check Adafruit's website


Go to http://particle.io and select the BUILD option to open the web IDE. 

Create a new 'App' and call it Clock.

This project requires the SPARKTIME and ADAFRUIT-LED-BACKPACK LIBRARIES, so click on the libraries button, find each of these libraries in turn and click USE THIS LIBRARY selecting your new Clock app when asked to select the app.

Now you can paste the following code into your App. Note that the includes should already be there if the libraries have been imported correctly.

You will need to change your time zone offset on the last line of setup.

That's it - the display should start as soon as the Photon or Core resets. 

#include "SparkTime/SparkTime.h"
#include "adafruit-led-backpack/adafruit-led-backpack.h"

Adafruit_7segment matrix = Adafruit_7segment();
UDP UDPClient;
SparkTime rtc;

unsigned long currentTime;
unsigned long lastTime = 0UL;
String timeStr;
int colon = false;

void setup() {
  rtc.begin(&UDPClient, "north-america.pool.ntp.org");
  rtc.setTimeZone(0); // gmt offset

void loop() {
  currentTime = rtc.now();
  int min = rtc.minute(currentTime);  
  int hour = rtc.hour(currentTime);
  matrix.print(hour * 100 + min, DEC);
  colon = ! colon;

If you enjoyed making this project, and want to learn more about programming and using the Photon, check out my book on the Photon.