Update on the Barometer

Stepper driver
Stepper driver

It’s 11 months since I wrote about the Barometer.  It has been working well but not perfectly for a year now, and as part of my New Year resolutions, I decided to see if I could fix some of the issues.

The main issue was the tendency for the button presses to cause false triggering: e.g. if you press the button to move from the upper display to the lower display, this often caused the day to change as well.  At first I though this could be inductive pick-up between the button wires, run as parallel twisted pairs inside the casing.  But once I noted that switching of another appliance on the same dual-gang mains socket also caused false triggering, I realised that instability in the power supply must be the issue.    Perhaps the problem of double-triggering that I attributed to button bounce was also partly due to instability in the power supply?  So I put 100 μF smoothing/decoupling capacitors on the 3v3 lines close to the debouncing circuits. This seems to have fixed the false triggering both of button presses and external mains interference.

I have another issue: motor five moves in quarter steps.  I bodged this by factoring the step count by four.  The Pololu DRV8834 stepper motor drivers can operate in full steps or micro steps down to 1/32 of a step.  My motors move in half-degree steps which gives 640 steps over the usable 320 degree range of the motors.  This is plenty of resolution and moreover, it seems that the ‘micro-steps’ rely on keeping the motor coils energised, which I don’t want, as the display changes infrequently.  However, the drivers are set by default to operate in quarter-steps.  To get the desired full steps, pin M0 on the driver board needs to be held low. Pin M1 also has to be held low, but this is the default via an internal pull-down resistor.  Although I have fitted pull-down resistors to all the motor drivers, driver 5 operates in quarter-steps. Further investigation is needed.

Moreover, there is a warning that the rapid switching of the motor current can induce high transient voltages.  The suggestion is to fit a large electrolytic capacitor across the motor power supply close to the driver board. I had already fitted a 100 μF electrolytic close to the first driver board,  but given that the Pi’s power supply seems to have a fairly high impedance, and I had some more capacitors in my spares box, I fitted three more – so there was one on each end of the row of drivers.

The data sheet for the stepper motor driver boards also states that it has internal current limiting and that micro-steps may be missed if the current-limiting does not get engaged, because the motor coils will not be held at the correct current.  Since I’m not using micro-stepping, this doesn’t seem to be relevant, but who knows?

So, has adding a few capacitors made any difference?  Yes, indeed. The phantom triggering seems to have gone and the stepping accuracy has improved. The quarter-stepping is still an issue and will need more work.

But it means that I can get the forecast for different days and the upper and lower readings without the pointers going completely out of position.

I suspect that a big part of the problem is the cheapo Maplin plug-in power supply that I’ve got – fine just for simply powering the Pi, but not when you have another box of tricks connected as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.