Translate

Showing posts with label Motor Drive. Show all posts
Showing posts with label Motor Drive. Show all posts

Sunday 27 March 2022

Solar lighthouse garden ornament - A design that could never work.

About 12 months ago, the long and suffering Mrs Doz bought me a solar powered garden ornament, in the shape of a lighthouse. 


It's got a white 5mm LED, which is situated inside a rotating silver reflector. Quite a nice touch, and more effective than just a simple flashing LED... except it never worked properly. 

There's a push button switch on the lamp housing, which switches the unit on. After dark, the LED illuminates. Once. 

The following day nothing happened. 

It's not worked since. 

So I disassembled the lamp house to see what the fault was. It consists of two parts, the top part consisting of the solar panels, a charging circuit and LED driver, and a lower part with the motor and it's gearbox, and a 600mAH, AA NiMH cell. 

I popped the cover off the motor unit in an attempt to find out what the problem is.... and spot it straight away. The motor is connected via the push button switch, straight across the battery. As soon as it's switched on it will start turning, and eventually discharge the battery. The solar cells aren't big enough to keep the battery charged up enough. What a silly design. 

I was hoping that the LED driver in the top would be able to provide a suitable switched supply to the motor in a similar way to the LED, but alas no, it's got a small flyback converter to provide ~2.1V to drive the LED. 

So, a plan is hatched... 

A separate solar cell, and battery connected by a wire to the motor unit. 

Recently we had to replace another solar light in the garden, after it was damaged over winter. This has yielded a nice solar panel and it's fitted with a single AA NiMH cell, excellent. The battery is tested, and looks to be in reasonable condition. The control electronics in this enclosure are removed (again, it's a flyback converter)

So we need a circuit to charge the battery during the day, and switch on the motor at night. 


The solar cell charges the battery via D1, a BAT43 small signal Schottky diode (a strange choice, but it's rated to 200mA, which is more than the charging current capable of being delivered by the solar cell, and it'll have lower forward voltage drop than a normal silicon diode), which prevents the battery discharging into the solar cell at night. When the cell goes dark, Q1 loses it's base bias via R1 &R2, and switches off, which causes the voltage at it's collector to rise. This in turn switches on the base of Q2, which causes it to conduct and switches on the motor. 

After a bit of experimentation on some breadboard to get the values of R1 & R2 right (this effects the threshold where the unit switches the motor on), it's built up on a bit of perfboard, and fitted inside the enclosure.
After sealing everything up with some liquid rubber, it's taken outside ...





Now just to wait for nightfall...




Wednesday 11 August 2021

Sanyo TP1100 Turntable repair.

Colin rang...

"Got this Sanyo turntable here ... doesn't work, got a new Rega Carbon cartridge on it, but doesn't spin. Nice thing, heavy , all die-cast ... are you interested for £15?" 

Now, under normal circumstances, I would have taken Colin's arm off... but right at the moment, I'm planning a major workshop build, and if I bring anything else into the house, the current Mrs Doz is likely to serve divorce papers. I politely declined.

... time passed ...

Colin rang..

"Need a turntable for Fiona, sensible price.. have you got anything?"

"I haven't, but what about that Sanyo?"

"It doesn't work."

"No, but I'll see to that... "

So it arrives in top-secret, under the cover of darkness....


The turntable powers up OK, and moving the arm over should automatically start the platter. Nope, but the neon stroboscope lights up.... "The lights are on, but there's nobody home".

First off, remove the mat and platter, and place safely out of the way, then remove the screws from the edge of the blow-moulded bottom cover.

There's a DC controlled direct-drive servo motor, and some levers to automate the turntable. 

The simple DC controller is mounted to the impressive die-cast chassis, and is powered from a small transformer, well away from the arm end of the deck.
The turntable's power is controlled by two microswitches attached to a spring loaded lever at the base of the arm. 

The microswitch nearest us controls the power to the neon... The other switches the secondary from the transformer (about 20VAC) to the speed controller board. 



The neon works, but the motor doesn't, and a few checks prove the microswitch isn't working anymore. 

It's removed, and a replacement sourced. 

Unfortunately, the replacement is useless... It requires too much force to engage the switch. The spring on the lever is too weak, and with good reason, its triggered by a cam on the base of the arm... too much force here would be disastrous. 









OK, now a switch with low force is available, but not in that form-factor. Some head scratching ensues... The original (but broken) switch is refitted. The two yellow wires from the broken switch are shorted together, and tidied up. 


The transformer's feed from the LIVE side is disconnected and is now connected to the switched live side of the neon strobe... so when the neon's on, the transformer is connected, and it's output fed to the speed controller... 




... all is well. Almost. 

There's a *click* on the audio as the turntable starts up and stops. We'll have to live with that, until a suitable switch is obtained, anyway ...

Another saved from landfill! 

The turntable is tested with Nicky Thomas "Love of the common people"

Sunday 22 November 2020

Strathclyde STD 305D Display fault

Remember the Strathclyde STD 305D I built a supply for here? Well, it ran for a while then the display started to play up .... 

It stopped indicating the correct speed. Ugh.


I got it back into the workshop, and poked around the board. 

The vacuum fluorescent display is driven by a long obsolete counter, a Plessey ZN1040. The good news is, it's actually counting. The bad news is that's all it does. The way it indicates RPM is it counts some pulses derived from the motor's tachometer , and a reset pulse comes along and resets the count. The display is then updated on reset, so 33 pulses per "reset" indicates 33 RPM on the display ... A prod round with the 'scope shows the reset pulse is missing. The pulse is generated from a Plessey ZN1034 precision timer IC, again long since obsolete. Damn. 


It's a bit like a posh 555 IC.. It's simply configured as a bistable. Replacements appear to be available on eBay, but are of questionable parentage. (You can't tell me that when this thing went obsolete in the early 80's, China had massive stocks of them).

We need to find another solution. 









This is a quick sketch of the relevant bit of the STD305D's schematic. 

As shown here, it's the Q output that feeds the reset pin of the counter. The complimentary output (not Q) of the ZN1035 timer is also feeding something, so we'll need to implement that also ..







 

The power supply available is 5V, so that's easy. How about an ATTINY85 ? Perfect. Two pins connected for both outputs, Q and not Q. Should be easy enough, and be easy to fit. Good, a plan. 

The program is simple enough ... 

#include <avr/io.h>
int timing = 1000;
void setup() {
  // PB 3 and 4 to output
  DDRB |= (1 << PB3);
  DDRB |= (1 << PB4);
}
void loop()
{
  //set PB3 , unset PB4
  PORTB = 0b001000;
  delay (timing);
  // set PB4, unset PB3
  PORTB = 0b010000;
  delay (timing);
}

I've used direct port manipulation to minimise the overlap between Q and not Q. digitalWrite takes longer to change the state of the port. I don't know whether that would be an issue in this application, but it's best practice. We can tweak the timing variable to suit.

The ATTINY85 is loaded into an adaptor and programmed using my ISP programmer



As power consumption isn't an issue, the micro is set to run at 16MHZ internal clock. 




The ATTINY85 is pressed into service, and produces odd results. The reset line still isn't resetting the ZN1040 counter. Checking through, I connect it directly to the reset line of the ZN1040 ... not a good idea, as this instantly kills the output pin on the TINY. :(

Liberating the ZN1040 pin from the board, the pin on the IC measures a few ohms to ground. Not only is our ZN1034 dead, but so is the ZN1040.... What's common here? Ugh , the +5V rail. 

I measure the 5V rail ... it's 5.1V , close enough.... hang on 5.2 .... 5.3 ... it ends up at 6V , the regulator on the power supply board is shot. It's a simple enough Zener diode and transistor affair... I sack it off, remove the BD239 pass transistor, and fit a 7805 on a heatsink. It's all a bit too late for our poor ZN1034 and 1040 though. 




So what to do? Obviously remove both IC's. Feed the pulses from the tacho into an arduino, calculate the speed, and output it over the existing discreet transistor drive circuitry to the display. Works for me. 

Studying the datasheet for the ZN1040 , gives us all the info we need... 


OK, so this is shown for LED displays, but the principle will be identical. Four lines switch on the supply to select which digit MSD (Most significant) to LSD (Least significant), only three are connected in our application ... We'll need to multiplex these, and the actual segment drives (A-G) need to be pulled low to illuminate the display. 







First up, is go get our arduino to read the pulses from the tacho. 

They should be arriving at pin 22...


















... and, sure enough there's a nice negative going pulse train arriving, and it varies with the speed control. Great. 

We'll drop these pulses into INT0 on our arduino, and trigger an interrupt on a falling edge.

 




A quick piece of code is conjured up to read RPM and output over the serial interface. It's uncalibrated at present, but is near enough , reading 33, 45 and 78 RPMish...
Excellent, we can return to calibration later (the turntable is currently upside down with no platter on it).

Now to deal with driving the existing display. The ZN7040 is capable of muliplexing a 4 digit display. In this application only three digits are used. A quick bit of reverse engineering shows those digits are the 3 most significant digits. These are coupled to  our arduino on pins A1- A3 and set to digital outputs. Each of these pins feeds a grid, and taking this high allows the display to function.


Arduino pins 3 to 9 are connected to the segments drives for A through to G. These are used to individually control each segment's anode. Pulling the pin low, switches on the anode, and illuminates the segment. 

Bingo, a muliplexed display. Now to couple the two parts together...




And finally to reassemble and calibrate ...



Nice!



I will NOT be beaten by mere machinery!!

The software is available as usual from my github.

And another saved from landfill, these really are a stunning deck. 

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