Translate

Saturday 8 July 2017

Classic Mini 1275GT Electronic GPS Speedometer and multifunction display.

The Mini 1275GT is fitted with a mechanical speedo. It's driven from an output on the gearbox via a cable, which wings it's way across the back of the engine bay, through the bulkhead and into the speedometer itself. The cables always seem to get cooked by the heat from the exhaust manifold, and fail fairly often. I've got sick of changing them ....

The 1275GT's speedo reads (rather enthuiastically) to 120 MPH.....


..... and is expensive due to it's rarity


Surely there's a better way to drive it??


Plan A...

Get a broken speedo cable and harvest the speedo drive fitting, attach that to a small electric motor, and use that to spin the speedo drive to show the correct speed. Get the speed from a GPS module, PWM the motor to show the correct speed. Even the odometer will run correctly.

Brilliant... 

The speedo is marked 1248 TMP on the dial... this means it needs 1248 turns per mile.. So at 60MPH that's 1248 RPM, and at 120 MPH, 2496 RPM... so a 2,500 RPM motor would be excellent.

A small motor and gearbox was procured from eBay...

oh it IS small!

The end was removed from a speedo drive cable ....
... and attached to the shaft of the motor's gearbox...
Running some tests showed the motor would drive the speedo, but it was going to need some sort of feedback to stabilise the speed... and then it became very obvious that this tiny motor was not going to be man enough to drive the speedo for any length of time at any speed... it was VERY hot.

I looked in the junque box and found a few other motors....

This looked promising, but was too lumpy at low speeds... a similar motor was also tested with similar results. Shame as the torque provided by these motors was good enough that speed control would not be required.




I then found this beauty, with a tacho so I could create some feedback to accurately control speed...

During tests it seized up :(







What about a stepper motor? ... nah not at 2,500 RPM :(

It became apparent that this was going to be tricky...

Plan B .....

Strip the speedo down, and replace the mechanical drive with a model servo...

Advantages... Easy to drive.

Disadvantages ...
Odometer won't work (replace with an LCD or OLED display?)
Means gutting an expensive instrument.
Positional 270 (or greater) servos are expensive, and have questionable positional accuracy.

... at least an "ordinary" 90 MPH speedo will be required for practice!

The cheap 360 degree servo shown is no use, it's a "continuous rotation" servo, which has no positional feedback at all. It simply turns one way or the other ad infinitum. To implement a positional servo, we'd need an expensive "boat winch" servo.

I'm not keen on this idea....

Plan C....

A stepper motor to drive the needle.

Advantages...
Easy to drive (may need an H-bridge), inexpensive. Accurate (especially a geared down unit)

Disadvantages...
Will need to get a zero position, something like a leaf or microswitch to set zero. Will need a display for the odometer.

OK, this looks feasible....

I had a nice cup of tea, and a bit of a think .... how does the speedo and rev counter work in Mrs Doz' posh Audi?

When you switch the ignition on in her car, the speedo and rev counter move to the full scale position, and then to zero before settling down to the correct reading .. must be driven by some sort of motor ....

After some googling, it turns out that manufacturers use a special instrument stepper motor to do this!

Vauxhall have one that's VERY cheap!

It's called the X27.168, and I bought 6 (Yes 6!!) for change out of a tenner on eBay! ... and some blue LEDs (not sure what I'm going to do with those!)

Not only that, but there's an arduino library at https://github.com/clearwater/SwitecX25
which will drive the things, and without an H-bridge! Oh joy!

A few feelers were put out for a gash speedo I could use as a test bed, and Tim at MiniMail (a superb purveyor of classic Mini parts) turned up a bit of an oddball speedo.

Look carefully at the picture, the KM/H and MPH scales are the same! It's a continental 1275GT speedo with a UK bezel. An ideal candidate.





I also ordered a 0.91" I2C OLED display to replace the odometer.











The bezel was removed (normally there would be a piece of glass over this, but it was missing)....












... the two screws either side of the speedo drive fitting was removed ....








... followed by the mechanism.







The pointer was carefully eased off the shaft...















... and the two screws holding the face to the rest of the mechanism removed. Note the state of the screws. It would appear I'm not the first to have been here!










Face off....











Remove the two screws each side of the support bracket.











Unsolder and remove the return spring.













Remove the two top and bottom screws and separate the magnetic coupling. The spindle drive and plate can now be removed....










... leaving the odometer digits.












Separate the split washer from the end of the shaft and remove the gears....












... and push the shaft out. Note there will be some resistance here, as there's a nylon split washer between the end of the barrel and the bracket.

Remove the odometer barrel...








Leaving us with a disassembled back plate.












... and a nice blank canvas !













I made a small hole in a cardboard box, so the zero stop pin on the face would sink in leaving me with a nice flat surface to work on. The OLED display is a little short, but otherwise looks to fit superbly. I can make a bezel up to cover the shortfall...







The rear bracket will need the barrel support arms removing or shortening though...










I was hoping to get lucky with the spindle size, but alas no. The mini spindle is a little smaller than the new stepper motor.....


















Thankfully, there's enough meat on the pointer to bore it out slightly with a very fine drill...












Although it's a good fit, a spot of thread lock will stop it moving once final assembly is complete.











Next job is to mount the stepper motor to the bracket. I secured the faceplate to the box to prevent it from moving about.....










and punched a small hole in the dead centre of the display, to centre up the motor shaft...












As there are no mounting holes in the vicinity of the motor mounting holes, I opt to glue the motor to the bracket. Suitable adhesives were considered ... Super Glue (cyanoacrylate), UHU "universal glue", Araldite (Epoxy) ... all of these were rejected. Super glue would be too brittle, and it has a propensity to run where you don't want it. I don't think UHU will be strong enough, and Araldite seems to be a bit "runny" these days.... I looked about for an alternative.... Epoxy car body filler? Strong, not runny, sets quickly if mixed with a touch more hardener than really required... let's give it a go!

Place a small heat shrink sleeve over the stepper motor shaft to prevent it getting stuck in any excess filler. We can remove this afterwards...










Mix up a small amount of filler, and apply to the bracket ...











... and place the motor carefully, so the shaft (and sleeve) push down through the cardboard box.

Hold in place until the filer starts to set (If you make a little too much, you can see if it's set on your mixing board)







Remove the protective sleeve. A little filler has oozed up round the sleeve. I removed this with a sharp craft knife....











... and the pointer test fitted. Looks good (must clean the corrosion off the centre though!) . Don't push the pointer on too hard just yet, we need to make sure the stepper motor is set to zero first.








Next solder some wires to the rear of the motor...


Note the pins aren't numbered on the motor....
Sort of standard convention would make pin 1 blue, pin 2 grey, pin 3 white and pin 4 purple... the colours aren't important, but connecting them up to the correct ports on the Arduino is.







We'll use Digital pins 4,5,6 & 7 as they are default for the library.

Pin 1 of the motor to digital pin 7 of the Arduino.
Pin 2 to digital pin 6
Pin 3 to digital pin 5
Pin 4 to digital pin 4



OK. Now we need to calibrate our pointer.

First off, setting the zero position. I couldn't get the example sketch in the library to run. It would compile OK, but didn't work as expected. So load this into your Arduino:-



This will set the motor to zero, run it round to half way wait for a second, and then back to zero.

Now push your pointer on (after you've polished up the corroded bit!). Hit reset. You should have something like this ....



You'll notice as the motor is finding zero, it jitters about a bit. This is normal.

Now we need to calibrate the full scale deflection, in this case, 120 MPH.

Load up the following sketch ...




... and connect a 10K pot, with the ends of the pot on 5V and GND, and the wiper to A1. Open the serial monitor window.

When you run the sketch, the pointer will zero, move to the halfway point, and then move to a point determined by the position of the pot.

Again, don't worry about the pointer jittering a bit, the sketch and electronics are simple, and there's no averaging on our analogue input, so it moves around.



Turn the pot unit the Speedo indicates 120MPH.












Read the value displayed on the serial monitor, and write it down. We'll need it later. It's 784 in my case.










A little black spray paint hides the blue PCB on the display nicely. The display was wired up and tested...










..and carefully glued into place with a smear of UHU universal glue to the raised part of the faceplate. It was held there until the glue has set.

I briefly added some text into this sketch to write "THIS WAY UP!" to avoid a mistake!







Whilst the glue made a reasonable job of holding the display in place. It wasn't quite up to the job. Another gob of body filler sorted that ...










The speedo could now be reassembled.
















Great, now for some other hardware...


The hardware needs a little explanation. The Arduino is connected to the display and GPS in a normal manner, it's the power supply that's a little odd, and with good reason. 
When the unit is running, we don't want to keep updating the EEPROM with the mileage, as the EEPROM wears out a little every time we write to it, so we need on only write to it every time the car is switched off. Now I did contemplate using an interrupt, writing the data and putting the micro to sleep every time. I decided against this because of the nature of the vehicles supply. During cranking the voltage can be going anywhere ... spikes of 75V, voltage falling to 6 ... generally unpleasant. When the micro wakes up, things need to be steady so everything comes back up in an orderly manner. We can't guarantee this. 

Here's the plan. When the car is initially switched on, The IGN line supplies 12V briefly (for a split second, until the starter is engaged) it then disappears...there's  a 6-second delay at the start of our sketch waiting for the GPS to power up, so nothing happens. The micro will shut down again. Now the engine is running, our IGN line returns, and supplies power to the 7805 via D3. The micro starts up, and runs it's set up procedure. Once that's done, the micro sends D8 high, switching the relay K1 via T1, and the 7805 is now getting it's power from the permanent 12V line. Any nasty spikes on the supply are dealt with by R3, and the two zener diodes, D1 and D2.

So we drive about for a bit, the speedo doing what it should. We stop, and switch the car off. The IGN line goes low, and this is sensed by D9. This runs the shutdown routine, which writes our updated mileage to the EEPROM, and sends D8 low, switching off K1, which kills the power to the micro.

.... then I got to thinking. In the car there's an ashtray in the top dash rail. It did more for non-smoking in the UK during the 1970's than all of the government health warnings put together... What about a nice display there? We already have GPS available, so what about a digital speedo and a clock ? We could easily measure the battery voltage. Outside temperature would be nice to satisfy the love us British have for moaning about the weather... 

 


Battery voltage is read through A0, via a voltage divider formed by R2 and R6. R6 can be used to adjust calibration. Temperature is provided by a DS18B20 temperature sensor. Excellent. I used a separate micro to avoid clashes, and memory issues (and, to be honest, it was all a bit of an afterthought!!) I also added some links, so the serial interface could easily be disconnected when uploading new software during development.

The electronics was built up on a bit of perfboard, and connected to some din plugs to connect to the various components. One each for GPS receiver, speedo (both motor and display), the "multi-function ashtray display", and the temperature sensor.
If you just wanted to add the multifunction display, you could simplify the power supply (no relay or switch-over needed), and just use the second micro. You'd want add the auto-config part at the start of the speedo sketch, and send the arduino's Tx line to the Rx pin on the GPS receiver as well)

Testing shows the speedo to be very accurate against another calibrated unit, so I'm pleased with that. 

OK, so now I've got git, the software (and the required libraries) can be found  at https://github.com/andydoswell/GPS_Speedo It's still here in the little text box too, for all you copy'n'pasters...

Addendum 04-Sept-2017 - get the software from the git hub page above. I've made a few revisions to prevent EEPROM corruption. The latest software will always be available on the git.



Here's the sketch for the multifunction display (also available from  https://github.com/andydoswell/GPS_MFD_for_car )



Here's a wonderful video of it in action!





*** STOP PRESS!!!*** I've now revised the software slightly... check out https://andydoz.blogspot.co.uk/2017/11/classic-mini-1275gt-electronic-gps.html

Thursday 29 June 2017

Mini 1275GT reassembly and electrolysis of rusty parts!



Here's a few pictures of what's been absorbing most of my time lately....






















It doesn't look like much, but there's all new brake lines fitted, lots of parts cleaned and painted and reunited with the car!

To clean up a lot of the metal parts, I've taken to electrolysis...

This involves making a mixture of about 10% ordinary washing soda (you can get this from Sainsbury's in the UK, £1.20 in my local store for a 1kg bag) and tap water.

You'll need a nice clean piece of ordinary mild steel (Don't use stainless). I used a plate, you can see it in the centre of the tank. And you'll need a power supply (I used my adjustable bench supply)

Connect the clean steel to the positive terminal, this becomes our sacrificial anode. You'll probably realise from the name, that this isn't a piece of steel you'll want to use again....



Attach the rusty part to the negative pole, and drop it in the tank.... Keep a small distance between the part and the steel plate.

Switch the supply on, and adjust the voltage until a bit of current flows. Small bubbles will rise to the surface. I found good results with about an amp of current flowing.

You'll want to do this in a very well ventilated area, as the bubbles are hydrogen and oxygen, and PLEASE switch off the supply before adding or removing things from the tank, a spark could ignite the gas.....

After a new hours remove your once rusty part.

You'll need to clean off the solution, dry it and paint it to prevent it rusting rapidly.



What's happened to the rust? It's on the anode ....

This is after just a couple of days of use... you can clean it up with a wire brush or grinder and it'll go again :)

Simple Arduino Thermostat with MAX7219 Display and DS18B20 sensor

Just shows how these jobs snowball....

James had seen Oto's dehumidifer controller, and said "I need something to monitor and control the temperature of my honey warming cabinet" (it's a beekeeping thing!)

A simple thermostat, with a nice clear LED display, and adjustable set point was born ....


You'll see the code, and most of the schematic is very close to the dehumidifier controller, so I'll not dwell too much on that.. the main difference is the use of the MAX7219 7 segment display, previously used on the GPS clock, and the DS18B20 temperature sensor, which I'd previously used in the pond pump controller.

Here's the code:





Ryan built up a nice enclosure....

















... and, in a stroke of genius, added a strip of red PVC insulating tape to improve the contrast of the display!