Email
 Microcontroller and PC projects Forum Index : Microcontroller and PC projects         Section -- Select Forum -- Off grid living and renewables   - Windmills   - Solar   - EV's Electronics and Microcontrollers   - Electronics   - Microcontroller and PC projects   - PCB Manufacturing Miscellaneous   - Other Stuff   - Site News   - Off topic archive. Classifieds   - Price Watch   - Wanted   - For Sale Guest Book   - Guest Book
 Topic: Driver for clock pendulum
 << Prev Page 1 2 of 2
Author
 Message << Prev Topic | Next Topic >>
Dabbler
Newbie

Joined: 04 November 2018
Location: Australia
Online Status: Offline
Posts: 9
 Posted: 06 November 2018 at 6:33pm | IP Logged
I have considered applying the push alternate swings but my preference has been to do a little often rather than a bigger push less often. I am hoping that the Micromite will be able to power the electromagnet with its 5V logic out signal strength rather than adding in external transistor etc. I may add a capacitor to boost the pulse output.

My thinking is that behind the scene, the TIMER counts 1, 2, 3, 4 . . . . and so on. At some stage it will go through the number "x". With the IF TIMER statement, my hope is that the micromite is aware of the rising count and when it reaches number "x" it will think the statement is correct so it will THEN take some action (in my case, trigger a pulse of a certain duration).
All I want is a way to program it so that when the TIMER gets to a certain number, an action is triggered.

Azure
Guru

Joined: 09 November 2017
Location: Australia
Online Status: Offline
Posts: 446
 Posted: 06 November 2018 at 6:57pm | IP Logged
I suggested letting the timer free run since it is unlikely to ever rollover being a int. Letting it free run saves the time taken to reset it inside an interrupt and just uses simple integer maths to process the difference between the start and end travel counter values in the main loop.

This is also explained in Section 5 Page 53 in the Getting Started with the Micromite pdf.

Regarding use of the If statement yes that would work but more likely you will need a multiline if statement. It is probably better to use an over or under limit comparison than trying to match an exact value in this case.

I think you may need to average readings and/or trigger coil based on previous timing or average as you won't know the duration or time to energise coil until after the pendulum has passed the point to energise it.

Once you know the delay needed (after at least one swing) then in the hall start routine you can start a timer interrupt to do the coil acivation. This will then occur between the Hall Sensor interrupts.

Edit: Not sure how long the time is between hall start and end interrupts, might be too short.

I read somewhere where someone used the magnet as an inductive pickup and sensed the voltage change (+ and - swing) and used the point where it crossed zero in between to then drive it as a magnet.

Edited by Azure on 06 November 2018 at 7:04pm

Dabbler
Newbie

Joined: 04 November 2018
Location: Australia
Online Status: Offline
Posts: 9
 Posted: 06 November 2018 at 7:32pm | IP Logged

I will try letting the timer run free

With the IF statement, do you mean something like

IF TIMER > x and TIMER < (x+10) THEN PULSE 18, f

I have also thought of averaging values over a number of cycles for the Hall pulse. It was simpler for me to use each reading and I didn't think it was a problem that the first few cycles would be off. It will take me a bit of thought how to do this but I recall some sample code in the Garage Parking Assistant where measurements are averaged, so this will help. I would rather not average the period time as this will stop being able to use it to adjust the position of the hall sensor to equalise the to and fro times.

I have also made some physical changes to the magnet so that the hall effect sensor will be triggered earlier in the swing and turn off later. This will separate the interrupt command interfering with the pulse generation. This will have the added benefit of magnifying the difference in the pulse length from narrow swings to wide swings.

The inductive pick up has been the usual way of powering pendulums. You don't even need a microprocessor in the circuit. I decided against this option for a number of reasons not least that I am even less knowledgeable about electronics than I am programming. It seems that the value of components needs to be fiddled with to get that type of system working optimally. I thought it important to leave the system as customisable as possible to fine tune the parameters. Currently, I am using a whole Micromite backpack display unit but once everything is sorted out, I hope to use a bare Micromite and if possible use the cpu sleep function during part of the cycle to maximise battery life.

Chopperp
Guru

Joined: 03 January 2018
Location: Australia
Online Status: Offline
Posts: 356
 Posted: 07 November 2018 at 9:28pm | IP Logged
Re pendulum length.

On SBS TV tonight Michael Portillo was up the tower containing Big Ben etc. Accuracy is kept to 2 seconds a day. They use pennies to adjust the time by a fraction of a second per day. Adding a penny raises the pendulum's centre of gravity ever so slightly, effectively shortening it, making it go faster & vice versa. 2 second swing.

Following on from Gizmo's telecom clocks:-
Back in the early 70's when I joined DCA as it was then, we had two pendulum clocks in the Perth airport equipment room (different sort) which drove the electro-mechanical clocks throughout the operation centres (Control tower, Flight Service etc) & passenger terminals.

Checked every work day morning against the PMG's talking clock or WWV on 10MHz if that was down. Again, small weights were either added or removed to adjust the time drift if necessary.

At one time during a Daylight Savings trial, the clocks were either not set or reset (can't remember which) at the required time. Caused a bit of chaos until adjusted correctly.

Edit. Just remembered that some of the less mature of us used to stand in front of the two units, lean forward a bit & try to sync our arms with the pendulums.

Edited by Chopperp on 07 November 2018 at 10:29pm

__________________
ChopperP

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register