Tuesday, January 28, 2014

Raspberry Pi: Python Traffic Light Program


Here is a very simple Python program to demonstrate the "Push your Pi ! 8 LED & 8 Button breakout board for your Raspberry Pi GPIO" from http://mypishop.com/ (I wrote about this board in an earlier post).

It used the left 3 leds for one signal light, and the right 3 leds for the other one. I know that the lights are all red rather than red/yellow/green, you have to use your imagination :-)



The program is very trivial, but hopefully easy to understand for a newbie. 

Make sure that you install the required RPIO package as described in another post.

Next step would be to use two of the push buttons to indicate traffic in the left turn lane and trigger a flashing advanced green.



Eric Pierce VA3EP - See the Disclaimer in the Introduction

© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.


Monday, January 27, 2014

Test Equipment: Atlas DCA Semiconductor Analyser Review

 
Atlas DCA - Semiconductor Component Analyser - Model DCA55
 
 
 
I saw this advertised in the back of QST magazine a while back and it looked very interesting, so I just picked one up from a Canadian supplier. For the money (less than $100 CDN) it has pretty amazing capabilities. To quote directly from the manufactures website:
 
"The Peak Atlas DCA
A fresh approach to component analysis has resulted in the fantastic Peak Atlas DCA, an intelligent, slim and invaluable tool. A world of detailed component data has never been so accessible. Just connect your component any way round and press the test button. The Atlas DCA will then present you with detailed component information in concise, easy to read, scrollable pages. The displayed information will include: the component type, special component features, component pinout, and measured parameters (such as gain, leakage current, gate threshold voltages, volt drops etc...). No more searching through data books and catalogues in order to identify components and pinouts, the Atlas DCA does it all.

Analysis Portfolio
It doesn't matter how you connect the test clips to the component, the Atlas DCA can analyse a vast number of different component types including bipolar transistors, enhancement mode MOSFETs, depletion mode MOSFETs, Junction FETs (only gate pin identified), low power thyristors and triacs (less than 5mA trigger and hold), diodes, multiple diode networks, LEDs, bi-colour and tri-colour LEDs. It will even identify special component features such as diode protection and shunt resistors in transistors. For two-leaded components such as diodes and LEDs, any pair of test clips can be applied to the component any way round, the Atlas DCA sorts it all out for you.
 
Simplicity
There is no on/off switch, power is automatically turned on at the start of an analysis and then automatically turned off if inactive for more than 30 seconds. Each page of displayed information is presented in manageable amounts, with each page being displayed when you want it. If you want to concentrate on the "pinout" page then just select that page, you don't have to see information that you don't need."
 
 
In my tests, it does exactly as described above. I tried a few new semiconductors I had on hand, and it measured them perfectly. I especially like the fact that you don't have to worry about how to connect the leads.
 
I then grabbed a few components (from scrapped devices) from a box in my junk closet labelled "unsorted semiconductors". First one I took it determined to be an "Enhancement mode FET", and it rattled off all the parameters. Next one was a Silicon Transistor. Next I grabbed something that looked pretty old and probably was socketed, and it said it was a Germanium Transistor. Next it found a Darlington Transistor and even told me that it had a base to emitter resistor and a back connected diode from emitter to collector. I'm impressed. The wonders of cheap computer chips and clever software that make all this possible.
 
So if you are looking for a nice little semiconductor tester for building and repairs, this is just the ticket, IMHO.

Note that they have other test equipment, including a more advanced semiconductor tester that connects to your computer USB port, LCR and Impedance Meters, Capacitor Analysers, Network Cable Analyser, Thyristor and Triac Analyser and some other things.

 
Eric Pierce VA3EP - See the Disclaimer in the Introduction

© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.


Sunday, January 26, 2014

Software: Good free remote computer access solution



If you are looking for a good free remote access product to get to your home computer or to help friends and relatives try TeamViewer (free for private use).

Works great for me (even works through the Xplornet double NAT).

Was using Logmein, but they cut off free support for that. I am glad I switched to TeamViewer as it is much better, imho. There is a windows app that you install, and it caches the long hex IDs and passwords on their website. So a single login to the app allows you to click and open any remote computer, slick.



Eric Pierce VA3EP - See the Disclaimer in the Introduction
© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.

Saturday, January 25, 2014

Raspberry Pi: 8 LED & 8 Button breakout board


I picked up this interesting board from user 9030plc on eBay (visit store here). 



From the eBay description:

"Push your Pi ! 8 LED & 8 Button breakout board for your Raspberry Pi GPIO
Perfect way to learn how to use the GPIO pins.
Plugs into the Raspberry Pi GPIO connector.
Has eight bright green LED's and eight momentary switches.
For a more detailed discription see
For assembly and JAVA programing see
The normall connector sent mounts directly to the Raspberry Pi.
A box header is available at no charge but you must request it with your order.
Does not include Raspberry Pi or case. Requires assembly."

This would be a very good board for doing some beginner level programming without worrying about shorting things out on a breadboard.

I also found some other useful links concerning the board. Here are the vendors assembly instructions, but the ones above are more detailed. Here is a Python test program, but I find that the above program uses some advanced Python features that newbies may not understand.

Using ideas from it, I created this very simple Python test program that lights a led when the corresponding button is pushed, and should be very clear for the beginner.
Note to run the Python program above on out of the box Raspbian you need to install the module RPIO (which is an "advanced GPIO for the Raspberry Pi. Extends RPi.GPIO with PWM, GPIO interrups, TCP socket interrupts, command line tools and more"):

     $ sudo apt-get install python-setuptools
     $ sudo easy_install -U RPIO

IMHO this is not really a "beginners" soldering kit, you need a fine tip soldering iron (preferably temperature controlled), fine solder, good eyes and a steady hand. Some of the holes are very close and easy to create solder bridges across.

Eric Pierce VA3EP - See the Disclaimer in the Introduction

© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.




Thursday, January 16, 2014

Raspberry Pi: 37 Sensors and Output devices for less than $100


I saw this in my daily eBay alert, and just HAD to post it (already ordered one :-)
I will copy the pertinent information directly from the listing (with some interesting translation, note that the "hydrargyrum-switch sensor" is probably a "mercury-switch sensor").

This is the seller's "store" in case the listing goes away, they have a lot of other interesting stuff, including Arduino):

_______________________________________________________

New SunFounder 37 modules Raspberry Pi Sensor Kit ,T-Cobbler

This new 37 Modules Sensor Kit provides all kinds of funny and completed modules for Raspberry Pi open source fans. These modules will output valuable signals directly by connecting Raspberry Pi Board. It is extremely easy for RPi fancier to control and use these modules. This kit will help you control the physical world with sensors.

Specification:

1.Passive Buzzer Module
2.common-cathode RED&GREEN LED Module
3.Knock sensor module
4.Shock-switch sensor Module
5.Photo resistor sensor Module
6.Push button Module
7.tilt-switch Module
8.RGB LED Module
9.infrared-transmit Module
10.RGB LED Module
11.hydrargyrum-switch sensor Module
12.two-color commoncathode LED Module
13.Active buzzer Module
14.Analog-temperature sensor Module
15.Colorful Auto-flash Module
16.Magnet-ring sensor Module
17.Hall sensor Module
18.Infrared-receive sensor Module
19.Analogy-Hall sensor Module
20.Magic-ring Module
21.Rotate-encode Module
22.Light break sensor Module
23.Finger-Pulse sensor Module
24.Magnetic spring Module
25.Obstacle avoidance sensor Module
26.Tracking sensor Module
27.Microphone sensor Module
28.Laser-transmit Module
29.Relay Module
30.18b20 temperature sensor Module
31.Digital-Temperature sensor Module
32.Linear-Hall Sensor Module
33.Flame sensor Module
34.High-sensitive voice sensor Module
35.humiture sensor Module
36.Joystick PS2 Module
37.touch sensor Module
38.400 Point Breadboard
39.Jump Wire x65
40.T-Cobbler with 26-Pin GPIO Cable
_______________________________________________________


Looks like a pretty good deal, free shipping from Hong Kong. If you had to go and source all of those items separately, would cost a lot more I am sure (if you could even get them in one of quantities).

I have bought a number of items from Hong Kong (even some from mainland China) without a problem, although shipping times can be a bit long. If it is a no show, eBay will refund you anyway (if you meet all the terms and conditions).

When I get it I will post a review.

EDIT 1: I actually found a review here for the Arduino version of the package. Looks like the hardware is not too bad, but documentation a little skimpy and code samples not the best.

EDIT 2: I received this item in about 2 weeks. Here is the box they came in:





Here is the rather meager documentation. The small item in the lower left is a little booklet that gives the pinouts for each device:



And here are the contents of the box spread out on the table:


The sensors all look of reasonable quality parts and workmanship, the raspberry pi to breadboard adapter does not fit perfectly to the small breadboard power supply rails, I had to bend the power supply pins a bit to make it fit, but it seems to connect. I ended up taking off the yellow plastic spacers and bending the pins 30 degrees one way, then back and the fit is better:




There is a website referenced in the documents  www.sunfounder.com  but there does not seem to be anything there. I emailed the seller, and he responded within a day that there is no specific documentation and code examples for the Raspberry Pi (they are working on it). The only documentation is the version for the Arduino:



I have taken a look at it, and there is a detailed PDF that describes each part, and gives some example Arduino code. By reverse engineering the Arduino code, you should be able to get them working on a Raspberry Pi with the language of your choice, but this is not a project for the newbie, IMHO. Some of the sensors are a simple digital 1/0 value, others are an analog value and others are a more complex protocol. When I get some code going, I will post it here.

Also make note that they all seem to be 5 volt supply and signals, so you will have to convert the logic levels from 3.3 to 5 volts. Also, the Raspberry Pi does not have direct Analog inputs, so you will have to use an external PICAXE or another A/D converter chip. 

He also offered to replace the breadboard adapter, but I don't think that I will bother at this time. I have to admit that I was rather amazed by the speedy and friendly email response, the vendor is clearly trying hard to provide customer satisfaction. 



Eric Pierce VA3EP - See the Disclaimer in the Introduction


© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.

Monday, January 13, 2014

Raspberry Pi to PICAXE via I2C


Two separate programs, one Python program running on the Raspberry Pi and the other in PICAXE basic running on a PICAXE chip and communicating by I2C allow you to use the PICAXE chip as a digital / analog bidirectional I/O expander chip with up to 31 digital/analog I/O pins. So you get a lot more digital input, digital output and analog input pins than you have on the Raspberry Pi alone. As IC2 can support 127 devices, you could support many PICAXES all on different addresses for hundreds of pins of I/O.


You can download the rPI Python and the PICAXE basic code from here. (For some reason, when I tried to paste the code inline in this blog post, it got munged, apparently this is a know issue).

I have wanted to do this for a while, and was thinking about using good old serial but then I decided to see if anyone had done anything similar using I2C. I found this blog post by "AntMan232" which gave me the starting point. Thanks!

I use a PICAXE-40X2 chip which gives up to 31 pins for all kinds of digital and analog I/O, and is a 40 pin DIP package so is easy to work with on a regular proto board. It is available from suppliers in many countries (i.e. PICAXE-40X2 from Canada). The PICAXE is a Microchip PIC microcomputer chip with a special bootloader/OS on it that allows you to develop and download code with the free PICAXE editor.

One could also use the PICAXE ability to do Pulse Width Modulation, control RC servos, drive LCD displays and lots of others, see the PICAXE documentation.

If you have not worked with the PICAXE toolchain, see this older blog post.

Once the rPI has been set up as I2C master and the PICAXE as I2C slave by programming it with the code below, the communications is actually very simple. The rPI Reads/Writes variables into the PICAXE scratch pad where the PICAXE can read and write them. Basically the scratchpad acts as  a bidirectional "window" between the PICAXE program and the rPI Python program. The values are moved back and forth in the background with no further action on the part of the program using the I2C protocol. Very slick!

As the circuit is very simple, I have not drawn a schematic as the hardware setup on the breadboard that I am using is quite simple, but all of the pin to pin connections are shown as a table in the PICAXE source code below.

The PICAXE is powered from rPI 3.3 GPIO pins, draws <10mA. Since rPI can only supply 50 mA, outputs should be buffered. Digital outputs therefore drive 74HC14N buffers to LEDS, powered by a separate 5 volt power supply.  Analog inputs are from a wiper of 10K pot from 3.3V to Ground. Digital inputs are active pullup to 3.3V; sw to Ground. See PICAXE manual for programming cable schematic (don't leave out resistors). Be sure to use lots of capacitor bypassing on your breadboard.



Eric Pierce VA3EP - See the Disclaimer in the Introduction

© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.



Raspberry Pi: Another Homebrew Prototyping Breadboard


I modified a prototyping breadboard that I had originally build for prototyping Microchip PIC devices by adding a Raspberry Pi. As what I have done may give people some ideas for homebrewing their own out of junk box parts, I will describe it a bit more.


As described in my discussion of another prototyping board, I like to have things securely fastened down so that you don't accidentally knock something out of whack, and you can pick the whole thing up and move it around. The only "moving parts" are the wires and components plugged into the solderless Breadboard / Proto Board units.

You can see where I mounted the rPI to a small aluminum plate (made from some scrapped electronic device chassis) using insulated grooved washers (to keep from shorting connections on the bottom). The plate is in turn screwed to the front bezel of the prototyping board. I used an Adafruit Pi Cobbler Breakout + Cable to get from the rPI GPIO pins to the proto board.

In my normal manner of scrounge and re-use, the main chassis is made from an old CD player that I found on the side of the road.

In the lower left front corner is the original power switch, which switches the original power cord to a +/- power supply inside consisting of a center tapped transformer, bridge rectifier, electrolytic filter capacitors. I use 3 terminal regulators to produce +3.3, +5, +12 and -12 voltages (most commonly needed for circuits). On the lower right front panel are 6 LEDS monitoring the unregulated and regulated voltages. You can find schematics for this type of regulated analog power supply all over the internet. Just be VERY careful working on the 120 volt primary side, heat shrink or tape all exposed connections as 120 volts can KILL YOU INSTANTLY. If you do not have the knowledge and skills to work with high voltages, buy pre-build power supplies to be safe.

The raspberry PI is actually powered by a separate +5 volt power supply out of the picture. Make sure that since the rPI GPIO pins as 3.3 volts, that you use all 3.3. volt circuits, OR do proper level conversion.

On the left hand top from the bottom are 8 leds that can be used to monitor a byte on the proto board. Above that are 4 LEDS to monitor the regulated +5 (2 supplies), +12 and -12 switched power to the board, with the switch just above that.

Above the power switch are a couple of switches and a connector that used to be used for a PIC programmer (no longer supported so removed). In it's place on the upper left corner is a Parallax 2 x 16 Serial LCD, very handy for monitoring and troubleshooting 5 volt TTL serial interfaces.

Along the top edge are 4 uncommitted binding posts, good from bringing leads from test equipment, etc. on board.

On the upper right is an LCD display using the parallel Hitachi HD44780 LCD controller (pretty much an "industry standard"). It is easy to interface this with a rPI or PIC/PICAXE.

Below that is a couple of knobs for LCD contrast, and speaker volume (small speaker on the side).

Below that are two knobs with 10K pots from +V to gnd to generate analog voltages.

Below that are 12 toggle switches and 2 push button switches to generate digital test signals.

Down both sides of the large white/blue proto board in the middle are proto pins on paddle boards that connect to the signals coming to/from underneath from the power, LCD, pots, switches, etc. These paddle boards were cut from a surplus proto board that plugged into the ancient IBM PC bus, so this would be hard to find. You could fabricate something similar with multiple  Adafruit Pi Cobbler Breakout + Cable, I suppose.

Note also that I have lots of Electrolytic and Ceramic bypass/decoupling capacitors plugged in on the power busses of the proto boards to provide transient suppression, this is VERY important for circuit stability. A lot of newbies leave these out, and end up with flaky operation of their circuits.

So as you can see, this prototyping breadboard provides a good solid base with lots of I/O devices for different experiments, without a ton of loose wires and parts lying all over the workbench. That makes if very hard to troubleshoot problems with your circuit.

Eric Pierce VA3EP - See the Disclaimer in the Introduction

© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.