Tuesday, 31 July 2012

At last something that works...


Okay, I now have a working Gambas program that will read a formatted RS232 data stream and display the data as a dynamic bar chart.  To test this I rigged up my trusty old Psion II LZ and wrote a little OPL (Psion programming language) script to output a suitable random data stream.  The project is running on a laptop at the minute because I haven't gotten Gambas onto the RasberryPi yet and apparently it is quite slow, but I love the graphics.

The system is designed to work with 8 sensors and the data is 10-bit (values between 0-1023), so the format of a data frame is (at the moment) 18 bytes as follows -

- 'A' as the start character, the program reads data and ignores it until it receives an A;
- Pairs of bytes representing the upper and lower 5 bits of the 8 10-bit data values;
- 'B' as a terminating character.

To avoid confusion and make debugging easier, the 5-bit data is sent as bytes in the decimal range 32-63.  The ASCII codes for A and B are 65 and 66 respectively so no valid data byte can be an A or B or an ASCII control character.  Once the whole thing is operating properly, I may changes these.  The program detects all the possible errors in a data frame such as invalid data, invalid frame length or the terminator arriving too early and if any of these occur, the bad frame is ignored.  The program also has a timeout so that if no valid frame is received in 5 seconds, the chart is reset to zero.

For testing purposes the baud rate is at 9,600, but this is because the Psion works best at this rate.  Once the PIC is back in action, I will test the baud rate in steps right up to 115,200 checking for errors and see how we get on.

Monday, 23 July 2012

50 Shades of Raspberry


I got around to finishing off the repair of the DVI/HDMI monitor and here it is re-assembled and running a test with the RaspberryPi computer.  The RaspberryPi is temporarily in a simple Lego box to keep it from being damaged.  The connecting HDMI-to-DVI-D video cable came out of DiscountNI of all places for just £2.99, which was a real result.


The small (and very tidy) power supply came out of an obsolete PC and I re-wired the mains input and removed all of the output connections before re-connecting one disk drive power cable with 2 Molex male connectors on it to provide 12v and 5v to the monitor.

At the monitor side, I stripped out the parts connecting the broken internal power supply to the main circuit board (mainly the isolating transformer) and re-cycled a Molex female connector from an old DVD drive as a power input connection.  Some heat-shrink sleeving and couple of cable ties to neaten things up and the monitor is now running off the external power supply.

There are some advantages to this arrangement.  The second Molex connector can supply a very healthy 5v to the RaspberryPi or alternatively the 12v supply could be used to run an obsolete laptop main-board via the battery connection.  With a bit more soldering, 3.3v can be easily obtained from this power supply for running experiments using 3.3v ICs and communication modules.

Monday, 2 July 2012

Raspberry Jam


Well, here's the proof that I finally got hold of a RaspberryPi computer (for £25 including p&p).  The odd arrangement of the monitor has its own story of course.  I was given this Hanns-G LCD monitor recently by another kind Freegler, but the power supply was faulty.  What made it worth fixing was the DVI interface which can be directly connected to HDMI and HDMI is what the RaspberryPi outputs. So I took it apart and found that it was basically running off 12v and 5v which was easy enough to test rig from an old mini-PC power unit.  The monitor has a good crisp image and once I tidy the wiring up a bit it will be fine for use with the RaspberryPi.  The HDMI-to-DVI cable was £2.99 out of a local discount shop.  Always worth a look in Poundland, World of Pound, Home Bargains and the other discount shops, you never know what they have.


For the time being, we built a Lego box for the RaspberryPi, pretty much from scratch.  The sticker on the top was to hint at the computer being destined (one day) to be the front end for a vehicle diagnostic system, but that's as far off as it ever was!  It's a lot of fun trying to get there though.