Monday, 27 May 2013

TV output from Arduino

Little video showing a 7-inch LCD monitor connected to an Arduino running the TV-Out library.  For this test I connected a Manifold Air Pressure (MAP) sensor directly to the Arduino using analgue pin 0 (AN0) to create a bonkers boost graph.  Sucking and blowing on the pipe makes the bar graph change.

Sunday, 26 May 2013

Start Up Logos & Tachometer

Bitmap of MR2
MR2 Black-and-White Image
I got bored today and started mucking around with a start-up logo for the vehicle data system.  The Arduino TV-Out library has a neat 'Bitmap' function that will load a properly encoded 1-bit image into the image buffer.  I spent a bit of time on PhotoShop working on a photograph of an MR2 until I got reasonable 1-bit black-and-white picture.  This was converted to a C++ style array using Image2Code, a neat little application and with a bit of editing, this was included into the Arduino sketch (program).

The result is pretty good for a 1-bit picture at 184 x 72 pixels and extremely Sinclair ZX81 retro.  The idea is to have this as a start logo and also for display when the system is in any idle mode.  It looks a lot sharper on a 6-inch or a 7-inch screen too.

I also got the Tachometer routine working on the 18F4520 PIC microcontroller.  It counts the time between pulses arriving on the INT0 interrupt pin and the inverts the time to give a frequency in Hz, which is converted to RPM x10 and sent serially with the other data.

The 18F4620 has 4 timer modules as opposed to the 16F series PICs 2 so there is an option to use another timer/interrupt to get road speed from the speed sensor signal that comes off the back of the speedometer.  I'll have to look into this, but it looks fairly straightforward.  This would give RPM, speed and 10 analogue metrics from the single microcontroller.

Monday, 20 May 2013

Battery Conversion

I have nearly finished converting the battery in the MR2 from the piddly little 35Ah to a bigger 55Ah one. There were a few considerations with this. The battery terminals were too small, but I got the big ones in Halfords along with new earth cables. I also discovered that all the time I've owned the car the engine earth strap was disconnected which explained why the car was so hard to start!

A trip to a scrap yard got a battery bottom clamp (off a Citroen) for a fiver and I made up my own rear clamp. The battery is clamped in securely and isn't going anywhere, but the big problem is the intercooler which is supported by the existing battery top plate (red thing below). If this wasn't the case I could lose the plate because it isn't really necessary, but then the intercooler would be flapping about a bit. As a stop gap I've bolted risers onto the plate because the new battery is 20mm lower than the old one and the top plate needs to be level, but I'm going to fabricate a new brace of some sort for the intercooler when I get more time.

Saturday, 18 May 2013

Where it all began

This is pretty much where my interest in microcontroller, computer interfacing and all the rest of it really began, way back in the Spring of 1989.  I had been interested in electronics since I built my first radio when I was about 13 or 14 in the late 1970s and I'd learnt to program on a borrowed ZX80 a couple of years after that, but this was my first proper interfacing project.

I was living in Wembley at the time, an impoverished student teacher and one of my tutors suggested a cheap robotics project might be interesting as a way into Logo and this was the result.  I used to make weekly trips on the Tube up to the Maplins in Edgeware to buy whatever I could afford.  I already had the Spectrum and brought that over on the 'plane from Belfast at some point.  The 'monitor' is a Sinclair Microvision, no word of a lie.  I used a 12-inch portable for the programming, but designed a user interface with huge characters, 4 times the height of the normal ones so they could be read on the tiny Microvision screen.

The Lego 'whirly' robot had 2 motors and eventually had feedback from DIY microswitches so it could tell pretty accurately where it was.  It could be steered using the joystick and the program learnt moves that could be played back.  Interfacing was via an 'IN31' board (which I think was the way the Kempston joystick interface worked) with extra TTL logic to give 8 input addresses and 8 output addresses.  You can just see the little blue relays which switched the motors on and off and backwards and forwards.

The inspiration was this book, which I found in a primary school library and borrowed for a year, but I did take it back and eventually got my own copy about 10 years ago which I still have.

And here's the scene of the crime, the upstairs flat in Metroland (Chalkhill Road, Wembley) that I was living in at the time.

Sunday, 12 May 2013

Shady tree mechanics


My 2001 Skoda Fabia workhorse started acting up today.  It is a very reliable wee car with 155,000 miles on the clock now.  The engine is the simple and tough 1.9 SDI diesel so there are few things to go wrong with it and the same engine in the Octavia is much sought after by taxi companies where the cars go on to 300,000 miles in some cases.  Anyway, it was doing the kangaroo diesel routine again and the usual suspect for this is the exhaust gas recirculation valve (EGR) which becomes clogged up with soot especially if there is poor fuel or crud in the tank.  It's a 30-minute job to clean it out with some carb cleaner, but you need a 6mm hex bit to get it off and when I went looking for mine I realised I had lost it down in the engine the last time I did the same job.  Clever.

Anyway, after some standard swearing at self and some pondering it dawned on me that I have a wee box full of Allen keys that I have kept from flat-pack furniture jobs and the like and there were a few 6mm keys in there.  5 minutes with the grinder almost setting myself on fire in a shower of sparks (health and safety?) and I had a neat little 6mm hex bit and Robert est son oncle (as Albert Camus said accepting a lift from his publisher).

I dedicate this post to my late father who never bought a tool if he could bodge a good one up instead.

Thursday, 9 May 2013

Power Of Three (Things)

I finally got it working tonight.

PIC --> Raspberry Pi --> Android App

PIC is reading 8 analogue ports and outputting the data every 0.1s via serial over USB.  The Raspberry Pi is running an Apache server and in response to an HTTP request to a PHP script, it reads the serial data and re-formats it into a simple fast JSON array.  The Android tablet is running a custom app from App Inventor to make the HTTP request, get the JSON response and display the data.

The next step is to get a nice bar graph interface working and set up the Manifold Air Pressure (MAP) sensor I have in the car so that the thing can be tested reading boost from the supercharger.

Oh yeah and I have to get the Raspberry Pi working as an Access Point (AP) again.  I did this before okay, but with a different wi-fi dongle.  This is critical to using it in the car to send point-to-point data to the tablet.

Friday, 3 May 2013

PIC Datalogging With Added Raspberry Pi

Here we have a PIC 18F4620 in data logging mode collecting analogue values from 8 ports and outputting them serially via the USB bridge.  The software formats the 8 10-bit analogue values into a 'frame' like this -


and these are sent every 1/10 of a second at a baud rate of 115,200.  The H is the top 5 bits (most significant) of the analogue value and the L is the bottom 5 bits (least significant).  To add clarity when testing, I added 40h (64) to these values to make them printable characters instead of control ones so the data frames can be viewed in the Putty terminal program.

This is Putty running on the Raspberry Pi receiving the data frames from the PIC.  The text 'SERIAL READY' is sent after a reset and is also a useful test.

What next?  Wait and see, but the clues are Apache, PHP5, Android and access point.

Need a cup of coffe now.  And some heat, for May it is freezing here in Northern Ireland and my wife's brother is getting married tomorrow so I hope it brightens up.