Wednesday, 14 July 2010

Psion II in on the act

I have been meaning to press my old Psion II LZ into service for a while. Now if you go way back in the blog you'll see that I was building a parallel port interface a while back for the Psion, but early tests revealed that it was painfully slow and also there were some bugs in the operation of the port, so I temporarily shelved that.

Having mastered RS232 on the PIC using JAL (which is just so good I had to order the book), this opened up another avenue, communicating serially with the Psion. So here we go, the Psion II is receiving the data stream from my 16F690 A/D device and selecting one of the 8 channels to display. I experimented with displaying a bar graph on the Psion LCD, but once again, the speed was against me. I fear I may need to look at some simple assembly to achieve that one.
Here's the full set-up with the Psion connected to the PIC via a (long) null modem cable, which would be spot on for connecting to my diagnostic system in the Toyota and taking readings up front in the driver's seat.

I'm keen now to try interfacing the Psion to the robotics SERIALLY, using a PIC 16F84/88 and a MAX232 to go from RS232 to general I/O, but with a bit of intelligence thrown in for good measure, things like command strings and so on.

Getting there!

Sunday, 11 July 2010

Stupid is as stupid...

Well after looking at the test circuit again I realised that I was using a pin on the PIC for 2 incompatible purposes, driving the RS232 communications and the enable line for the LCD display. Doh. One minor change and it is all working.

I discovered a handy procedure in the JAL libraries to display a progress bar or bar graph and although I could write my own it was quicker to just use this one. Voilá, a bar chart showing the analogue value, in this case a light level detected using a light-dependent resistor.

The LCD is only for testing and playing purposes, the real beef is the RS232 connection, shown here on an HP iPaq running Pocket Zeus Lite as a basic serial terminal.

The PIC is programmed to output the analogue value once a second (roughly) in a standardised 8-character format of

C1V0099# [C = channel; V = value (10-bit, range 0-1023); # = terminator]

which can be read by anything that can understand RS232.

So far only one channel is being implemented, but I'm going to remove the LCD now, re-program for 8 channels and start using the PIC timer and interrupts to get an exact 1 second interval between sending each set of 8 values.

Initially I'm going to use a Psion II for testing (seriously!) and later on build a bespoke dashboard module using a PIC 16F873, graphical display and steering column switches.

Thursday, 8 July 2010

New PIC

I finally got around to putting my 'new' PIC onto my new breadboard, the cool 16F690. It is very easy to rig up, only 3 external components for a minimal set-up. I wasn't sure if the Willem PCB3 programmer would work with it because the programmer is getting a bit long in the tooth, but by selecting a similar chip in the inventory it worked and I had a wonderful flashing LED. The program I wrote actually does an awful lot more than flash an LED, but that's always a good way to see something happening. Just as well because I then hooked up a 4x20 character HD44780 display and didn't quite get what I was expecting. The display is working correctly, but the code is sending some weird characters and I suspect a timing issue, so I'll look into that.

I'll sort an RS232 interface tomorrow and then we are well on the way to some tasty vehicle diagnostics.

Sunday, 4 July 2010

Rocks and Roll


Bit a departure this time.

My wife was at a school summer fete a few weeks ago and bought our son a fossil hunting kit for a pound. Basically it was a sandstone fossil encased in light plaster with a little hammer, chisel and goggles so you could have a go at 'excavating' your fossil. Anyway, my wee fella was really taken with this and has been showing everyone his fish fossil (on the left). I mentioned this to my colleagues, one of whom studied geology at university and tipped me off to a good place about 30 minutes drive away where Jurassic fossils are easy to find. I'd never heard of this before in spite of knowing the area pretty well. One problem is that it is along a stretch of busy and fairly dangerous road where most people wouldn't bother to stop.

So we set off this morning in the lashing rain, but by the time we got there it had completely dried up and we had a fun and interesting hour picking around in the rocks and came up with these fossils of ammonites and what appears to be a bone of some sort, maybe a fish tail. We probably missed lots more so we'll be back now we know what we are looking for.

Not exactly Sam Neill in 'Jurassic Park,' but not bad for a Sunday morning in Northern Ireland.

Thursday, 1 July 2010

Knocking around

I finally got around to replacing the knock sensor in the MR2 last Sunday morning.

The purpose of the knock sensor is to detect 'knock' in other words engine detonation and that allows the engine management to run the car with ignition advanced pretty much as far as it can go. If the sensor is faulty on the 4A-GZE engine, the 'Check' light comes on, you get error code 52 and the car goes into a safe mode with reduced performance so as not to damage the engine.

The original sensor was destroyed about 8 years ago by a careless mechanic who promptly went out of business before I could get it replaced. Just as well for him because a replacement ended up costing £150. I had tried several options to get around buying a new one including trying a wide-band one and one out of a Toyota Supra. The problem is that on cars of this vintage, the knock sensor was very narrow band and tuned closely to the knock frequency which is very specific to the engine and a function of stroke, bore, capacity, grandmother's birthday and so on. In other words using anything other than the correct sensor is not going to work. The galling part is that the actual active component is a tuned piezo transducer that you could buy for about £3, so the rest of the £150 is for a steel boss, a connector and Mr Toyota's works do.

The other thing is that the sensor is in a 27mm boss housing and has to be screwed into the block at the rear, a particularly hard to reach spot. Thankfully with the starter removed there is just enough room to get at it with a 27mm socket and that gave me a good opportunity to thoroughly clean the starter before putting it back in the car.

All seems well now with the new sensor, no error codes and the car seems more responsive as it should. The idle seems more stable now as well, which is a bonus although I still intend to change the coolant out to remove air bubbles which are a known cause of wobbly idling.

I also got around to fitting the shorter drivebelt for the alternator and now the air conditioning is pretty much disabled. If I can get it de-gassed soon I can take the compressor out to lighten the car and maybe as something I can sell for a few quid. This will also make fixing the oil pressure sender much easier when I get around to that because that means taking the alternator and bracket right out.

There's not a lot of room to work round the engine in one of these cars.