---

Tuesday, April 29, 2014

Review: Scana Plus Logic Analyzer

When IkaLogic (www.ikalogic.com) offered to send me one of their Scana Plus logic analyzers, I was delighted. Not least because the software to support this USB Logic analyzer is available for Mac. So no more having to crank up a virtual machine running XP and wrestle USB drivers into submission!

Overview



The device costs €199 (at the time of writing) direct from the Ikalogic store.

An oscilloscope will often have just two channels and require a fair bit of interpretation when it comes to working out how the irregular square-wave translates into 1s and 0s and indeed how those 1s and 0s translate into messages. A Logic Analyzer is designed to capture and analyze such signals with ease.

Unboxing and Installation

When the unit arrived, I was surprised at just how compact it was. This tiny unit is capable of 100 MHz sample rate on 9 channels, with capture times only really limited by your computer's memory and disk capacity.



The box includes everything you need:

  • Scana Plus unit itself
  • USB Lead
  • 10 x test clips and cable. (9 channels + ground)
The ScanStudio software is a free download from here. If like me, you are a Mac user then you will be glad to see that the software is available for Windows, Mac and Linux. 

After installing ScanStudio, I plugged int he unit, but couldn't get it to connect. Eventually, I realized that if, like me, you are using OS X Mavericks, then you have to run a menu option from ScanStudi to install the USB driver. 



I did they, and hey presto the device connected just fine.

Using the Scana Plus

The Scana Plus uses your Mac, PC or Linux computer running a program called ScanStudio to display the waveforms captured and optionally the results of their analysis.

The example above is the data coming from a 1-wire temperature sensor (the BS18B20) connected to an Arduino Uno board.

ScanStudio has the concept of "decoders" that you can apply to the data being sampled. It comes with a number of these pre-installed into your "Library/Application Support/ScanStudio/decoders" folder (on Mac) but you can also add other decoders or even write your own in JavaScript.



You can see the results of applying the 1-Wire decoder to the data in the closeup below:



You can see that the values of the data are displayed as hex. Great for trying to work out what's going on with some thoroughly unpleasant message format.

Conclusion

While cheaper logic analyzers are available, three features of this device make it worth a few extra dollars:

  • 9 channels - many logic analyzers are 8 channel. That extra channel makes it possible to analyze an 8-bit bus with an extra clock signal.
  • For this price range you would not normally expect 100 MHz sample rate.
  • Software compatible with platforms other than Windows.
   




Friday, February 21, 2014

Raspberry Pi Fridge Minder: receive an email when the door is opened

I decided to see what other kinds of project can be made from the MonkMakes Raspberry Pi Electronics Starter Kit, that I designed.


The kit comes with project cards and a link to download the accompanying Python scripts. And projects already include a light meter and email notifier, so I decided to combine these two projects into one and make something that will send an email whenever the fridge door is opened. 


This is particularly timely as the MonkMakes team are trying to loose some weight at the moment. The paper template on the Raspberry Pi GPIO connector is called a Raspberry Leaf.

It turned out to be pretty straightforward. The breadboard layout is shown below:


BTW. A big thank you to Fritzing for a great design tool.

The photoresistor needs to be inside the fridge, so we can use two of the male to female jumper leads. This will of course also provide us with proof to the eternal question of whether the light really goes off when you close the fridge door.

You can see the completed breadboard and Pi below.


To install the program on the Raspberry Pi, you probably want to connect using SSH (see this Adafruit tutorial). Run the command "nano fridge.py" and paste the following code into the editor.

# fridge.py

import RPi.GPIO as GPIO
import time, math
import smtplib, time

SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587

GPIO.setmode(GPIO.BCM)

a_pin = 18
b_pin = 23
led_pin = 24

GPIO.setup(led_pin, GPIO.OUT)
GPIO.output(led_pin, False)

def discharge():
    GPIO.setup(a_pin, GPIO.IN)
    GPIO.setup(b_pin, GPIO.OUT)
    GPIO.output(b_pin, False)
    time.sleep(0.01)

def charge_time():
    GPIO.setup(b_pin, GPIO.IN)
    GPIO.setup(a_pin, GPIO.OUT)
    GPIO.output(a_pin, True)
    t1 = time.time()
    t2 = t1
    while GPIO.input(b_pin) == 0:
        t2 = time.time()
        if (t2 - t1) > 1.0:
            return 0
    return (t2 - t1) * 1000000

def analog_read():
    discharge()
    return charge_time()


def send_email(username, password, recipient, subject, text):
    print(username, password, recipient, subject, text)
    smtpserver = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
    smtpserver.ehlo()
    smtpserver.starttls()
    smtpserver.ehlo
    smtpserver.login(username, password)
    header = 'To:' + recipient + '\n' + 'From: ' + username
    header = header + '\n' + 'Subject:' + subject + '\n'
    msg = header + '\n' + text + ' \n\n'
    smtpserver.sendmail(username, recipient, msg)
    smtpserver.close()

username = raw_input("Sending gmail address? ")
password = raw_input("Sending gmail password? ")
recipient = raw_input("Send email to? ")
subject = "FRIDGE VIOLATION"
message = "Someone just opened the fridge door!"

while True:
    reading = analog_read()
    if reading > 0: #dark so timeout
        GPIO.output(led_pin, True)
        send_email(username, password, recipient, subject, message)
        time.sleep(120)
        GPIO.output(led_pin, False)
    time.sleep(0.1)

You can test out the program without installing it on your fridge. Start the program using the command:

sudo python fridge.py

There may be a few warnings about GPIO channels being in use, which you can ignore. Cover the light sensor with a cloth or place it somewhere where it will be completely dark.

You will be prompted for your gmail email address, password and who you want to be sent an email when the fridge door is opened.


$ sudo python fridge.py 
Sending gmail address? myname@gmail.com
Sending gmail password? jkshdgfkayig
Send email to? youremail@somemail.com

When its running, you can uncover the sensor and you should see some trace that the email has been sent. Similarly, any errors will appear. 

The light sensor having fairly thin wires attached can just be shut in the door.




You may be interested in the books I have written about the Raspberry Pi.


Friday, January 31, 2014

BeagleBone Black Collars

Almost a year ago, I posted a blog entry on the Raspberry Leaf. A template to tell you which pins are which on the GPIO header. This was hugely popular and many people downloaded the PDF and printed their own leaves. Since then MonkMakes has been selling large numbers of ready-made and drilled leaves for the Pi.

I have just finished a book on the BeagleBone Black and of course suffered the same problem of working out which pin is which. Even worse on the BBB because it has so many GPIO pins.

So....... drum roll please ....... Enter the BeagleBone Collar!


These have self-adhesive strips on the sides and fit onto the edges of P8 and P9 like ears (another candidate name).

Here is the PDF.

But if you want a ready-made one with self-adhesive tabs, visit monkmakes.com




Learning to Solder? Try this Mega Kit from Jack Christensen.

Jack Christensen sent me one of his One Million Ohm's kits, so last weekend, my son and I decided to put it together. Well he made it and I got in the way and 'hovered' like a typical dad.


WARNING: When constructing this project, always remember that Ohm's Law dictates that V = IR, so if you can persuade just 100mA to flow through it, there will be 100,000 Volts generated!

Just kidding. The big resistor in the middle, serves no more purpose than being the butt of the joke. It is surrounded by four LEDs that flash in various patterns controlled by two buttons. The whole thing runs from an ATTiny and includes pads for attaching ICSP headers if you feel like hacking it.

Its really easy to put together, and a great first soldering project.


It includes everything you need, except a pair of AA batteries, and my son very much enjoyed putting it together. The only things to watch out for are putting the LEDs and chip the right way around.


Some of my books, that may interest you:



Monday, January 27, 2014

Conductive Paint Experiments

I have been experimenting with some Bare Conductive Paint that I bought from CPC after seeing it being used in screen printing at Lancaster's Highwire Lab. The paint is made by Bare Conductive in the UK.





The thirst thing I wanted to know was just how conductive is this stuff. So I cut myself a stencil with tracks of 1mm (40 mils) and 3mm (120 mils) and daubed paint onto the paper below.



It leaked a bit. I am really no good at art. However, the final tracks are good enough for a rough test.



Being somewhat impatient, I first tried measuring the resistance before the tracks were properly dry. The resistance was actually several hundred kΩ but falling as I watched. There is clearly a very high resistance until the paint is properly dry, which took perhaps 30 mins.

I left it for another hour to be sure and these are the results:

The 1mm (40 mils) track had a resistance of 780Ω / cm (2kΩ / inch)
The 3mm (120 mils) track had a resistance of 340Ω / cm (850Ω / inch)



So, its not quite like painting with wire at all, but that's not necessarily a bad thing as it means that you could very easily paint yourself some resistors. If you are using LEDs then just the tracks are going to provide more than enough current limiting resistance.

My next experiment was to see how well a surface mount 1206 LED would stick to the paint. So, I painted the arrangement shown below and popped the surface mount LED onto the wet paint with a pair of tweezers.





It actually sticks really well and shows no sign of falling off even when the paper is shaken vigorously and even curled up.

So the next step is to make an Origami frog and put a pair of SMT LEDs in series on its head to make it look demonic. The connections are made by painting back towards the frog's legs, where croc clips connected to a battery could be attached.




Conclusion.

This paint is an excellent product and very easy to paint with.

I will be trying out some proper stencilling with PCB layout's from EAGLE. It will be fun planning things out to account for the high resistance of the wire.

I also think there is probably some fun to be had with pre-painted Origami.


Tuesday, January 21, 2014

MCP79412 Real Time Clock Breakout Board Review

Recently, Jack Christensen, sent me a few goodies, including this really neat and low cost Real Time Clock (RTC) module. A RTC is useful, because it will keep track of the time even when the power is removed from your Arduino. It uses a long life lithium battery.




It comes assembled apart from the header pins which are included and just need soldering. You only really need to solder header pins to the I2C side of the board. Its a nice design, the pin headers holes just the right size so the pins don't fall out when soldering.

The board costs just $10 (on special offer at the time of writing) from Tindie and comes in an anti-static bag with three URLs on it:
  • Arduino Library: http://goo.gl/97rrbJ
  • Blog Post: http://goo.gl/MkBnjR
  • Tindie Store: http://goo.gl/UzAVcZ


I downloaded the library from the URL on the bag fetching the zip file, copying it to my Arduino/libraries folder and renaming it to remove the word "master" from the end of it. I then restarted the Arduino IDE and then run the examples program TimeRTC.

The module is easily connected to an Arduino using four male to female jumper leads.


The connections are:
  • Vcc on the RTC to 5V on the Arduino
  • GND on the RTC to GND on the Arduino
  • SDA on the RTC to SDA on the Arduino
  • SCL on the RTC to SCL on the Arduino

Uploading and running the test program produced the following output in the Serial Monitor.


Summary

This module does not use the usual DS1307 chip, but rather the Microchip MCP79412. This can be calibrated and is more accurate than the DS1307. You can read more about it in Jack's blog: http://adventuresinarduinoland.blogspot.co.uk/2012/09/yet-another-real-time-clock.html

My recommendation is that if you need an accurate low cost RTC then you will not go wrong with this excellent device.

About the Author
These are my books. Click on the image below to find out more about them.


Saturday, January 18, 2014

Raspberry Pi Electronics Starter Kit

One of the most frequently asked questions of me is 'where can I buy the parts for X' where X is one of the project in my books.

In an attempt to remedy this situation, my partner Linda and I have started on little on-line store (monkmakes.com) to make and sell things related to by books. That will include the books themselves, signed by the author if you wish (this is very good for my ego) but also kits of parts.

The web store is based in the UK, but we have no problems with shipping world-wide. Its very early days and we are still finding our way. So if you have any suggestions on what else we should sell, please contact linda@monkmakes.com.

Our first product is an electronics starter kit for the Raspberry Pi. 



This is breadboard-based and although it has the parts needed to build Recipes 9.1, 9.2, 9.3, 9.9, 9.12, 11.1, 11.2, 12.2 in my Raspberry Pi cookbook, it also includes 10 project cards that give you the breadboard layouts for ten projects:

  • Make an LED blink
  • Make 2 LEDs blink
  • RGB Colour Display
  • Thermometer
  • Thermometer Plus
  • Reaction Timer
  • Light Meter
  • Light Harp
  • Proximity Detector
  • Email Notifier
The projects are also accompanied by a download of Python programs to support the projects and provide user interfaces.

The kit includes the following components:

  • 470Ω resistor
  • 1kΩ resistor (1)
  • 4.7MΩ resistor (1)
  • Red LED (2)
  • RGB LED (1)
  • Switch (2)
  • 330NF capacitor (1)
  • thermistor (1)
  • photoresistor (1)
  • buzzer (1)
  • raspberry leaf (1)
  • breadboard (1)
  • male to male jumper leads (10)
  • male to female jumper leads (10)
  • 10 easy to use instruction cards
The Raspberry leaf (which we also sell separately) is a nicely printed template that has holes where the GPIO pins fit, making it easier to know which pin is which. I originally blogged about this back in February last year and it was a huge hit. You can of course just download and print the PDFs, but if you want something ready made, then we sell them ready made.


Anyway, please take a look at our store and let us know what else you would like to see us selling.


About the Author
These are my books. Click on the image below to find out more about them.