Experiment setup, start on timer turn disc at interval

Ya’akov

Joined Jan 27, 2019
10,242
Some thoughts on using ATtiny micro controllers.
I write some code to do what I think the TS requires.
As I had some ATtiny13A s in stock I decided to use one of them.
The internal oscillator is not very accurate but there is a register to fine tune it.



Les.
Nice, Les. Since the TS is talking about syncing 50 of these, I suggested an RTC with a GPS timebase. While it will cost a bit, a GPS with a 1PPS output could keep them all in sync.

The GPS time could be used to set the clock on startup and the 1PPS signal could be used to keep the RTCs exactly on target. Or the RTC could be omitted and the 1PPS signal could be used on an interrupt with a seconds accumulator variable used to manage firing the motor advance events.
 

vu2nan

Joined Sep 11, 2014
357
The requirement in brief, as I have understood it, is as follows:

- An eight-section (segment) circular disc is to index through 45°, once every hour, for 8 hours.

- The indexing is to stop at the end of the eighth index.

- The system is to start at the same time every day.

Here's how it could be accomplished:

1. Any suitable battery-powered motor could be used.

2. The mechanical interface between the motor and the disc would be an eight-slot internal 'Geneva' mechanism, which could be fabricated to suit.

1.png

Eight-slot (45 degrees) internal 'Geneva' mechanism Courtesy : Mechnovashia

One revolution of the motor, linked through a single pin (shown in green) to the slotted plate (shown in orange), would rotate the latter through 45°.

3. A quartz clock-based timer could be preset to start the mechanism at the same time every day and also to trigger an indexing every hour for eight hours.

The advantages of this scheme would be:

- No need for any special controller
- No need for any programming
 
Last edited:

LowQCab

Joined Nov 6, 2012
5,101
Using a Mains-Powered Synchronous-Clock-Motor,
( Minute-Hand = 1-revolution per Hour ),
each unit could just be left Plugged-In continuously,
with one full rotation every 8-Hours,
3 full rotations every 24-Hours.

The Geneva-Mechanism would need a small Bearing,
and a continuous slot routed into the bottom of the Platform to
avoid accidentally loosing synchronization with the slot.
.
.
.
 

Ya’akov

Joined Jan 27, 2019
10,242
The requirement in brief, as I have understood it, is as follows:

- An eight-section (segment) circular disc is to index through 45°, once every hour, for 8 hours.

- The indexing is to stop at the end of the eighth index.

- The system is to start at the same time every day.

Here's how it could be accomplished:

1. Any suitable battery-powered motor could be used.

2. The mechanical interface between the motor and the disc would be an eight-slot internal 'Geneva' mechanism, which could be fabricated to suit.

View attachment 290428

Eight-slot (45 degrees) internal Geneva mechanism Courtesy : Mechnovashia

One revolution of the motor, linked through a single pin (shown in green) to the slotted plate (shown in orange), would rotate the latter through 45°.

3. A quartz clock-based timer could be preset to start the mechanism at the same time every day and also to trigger an indexing every hour for eight hours.

The advantages of this scheme would be:

- No need for any special controller
- No need for any programming
It seems there would have to be a way to synchronize 50 of these in various locations.
 

vu2nan

Joined Sep 11, 2014
357
Using a Mains-Powered Synchronous-Clock-Motor,
( Minute-Hand = 1-revolution per Hour ),
each unit could just be left Plugged-In continuously,
with one full rotation every 8-Hours,
3 full rotations every 24-Hours.

The Geneva-Mechanism would need a small Bearing,
and a continuous slot routed into the bottom of the Platform to
avoid accidentally loosing synchronization with the slot.
.
.
.
Super, LowQCab!

The only hitch is the index time limitation (a few seconds).

Using the synchronous clock motor, the disc would be stationary for 30' and rotating for 30' every hour.

Nandu.
 

LesJones

Joined Jan 8, 2017
4,511
Going back to my suggestion of this type of 12 volt timer in post #2 that was rejected as it needs 12 volts to drive it's internal relay. I had a similar timer in stock so I had a look to see if a signal could be found that changed state without the 12 volt supply. I found that there was a signal that went from 0 volts to about 2.7 voltsbetween off and on. This signal could be used to drive a logic level mosfet or the input of a comparitor such as an LM393. As the minimum on time of these timmers is 1 minute the output puls would have to be shortened. (Unless the disk took more than a minute to rotate 45 degrees. The pulse could be shortened using a capaccitor and the other half of the LM393. The internal lithium cell seems to keep the timer part running for many months. (It would be a good idea to connect 12 volts to the timers for a day or so to make sure the lithium cell was charged.)
These timers can have up to 16 on / off periods set so 8 could be set to step the disk 8 times. The only problem I see is thet the TS may not be prepared to open the timer to connect to the required signal. IF the internals of all these timers are the same as mine I could point out where to pick up the required signal. Using thes timers that would all set to real time there would be no synchronisation problem.

Les.
 

LowQCab

Joined Nov 6, 2012
5,101
Why do they need to be synchronized in the first place ?
They move slowly, so who will notice if they are moving or not ?
.
.
.
 

LesJones

Joined Jan 8, 2017
4,511
Hi LowQCab, Is your question with reference to my post #27 ? Do you mean that the disk will rotate slowly when stepping between the 8 positions ? I imagined that it would only take a few seconds to move from one position to the next position. (Note. I have not seen any information to make that assumption.) Post #27 made me think that you have worked out a theory on the purpose of the experiment. I have had no ideas as to the purpose of the experiment. I am just hoping that the TS will tell us. It seems a lot of trouble to go to for something that will only run for a day.

Les.
 

LowQCab

Joined Nov 6, 2012
5,101
I'm thinking that this is one of those situations where a
self-fancied "Artist" has an exquisite "vision",
with zero clue as to what it may take to implement it.
And then, the requirements/specifications change on a whim during construction, repeatedly !!!

This is no joke or exaggeration,
I've had this exact thing happen to me on 3 separate occasions,
and with some very fragile Egos involved.

Challenges can be fun, as long as somebody else is paying the Bill !!!
And I really don't mind, cause it makes everyone think I'm a genius !!!
.
.
.
 

Thread Starter

bjz

Joined Nov 13, 2017
11
Sorry I got tied up with other stuff yesterday.
Thanks all for the help, really appreciate it.
As Les is very curious about the purpose, nothing secret about it. I didn't think it would be useful info, but now realize it actually might be.
In short, it's for an university experiment, the setup is an insect trap, that's why it's not big and it will be for outside spread out over a large area. Each small compartment is supposed to trap insects for one hour and then it will turn to the next compartment. So that's why it will only run for one day and all setups will be collected afterwards.
As for the synchronization. As I said, it's not necessary for it to be on the second, a couple of minutes difference between the setups is not a problem.
So is it not sufficient to sync the time of the RTC with a PC once, then it will keep time on the internal backup battery for a few days right ? They'll all have the same time. Or do I misunderstand something ?
And LowQCab, they will need to be starting and changing sections all at once as it's they are multiple replicas of the same experiment. Ideally, they will not move slowly and continuously, but step by step.
And btw, no requirements are changing, I simply asked for help on what option I have to make this possible. I do have some electronics knowledge, just no enough to figure this out from scratch. I realize some things might be to complicated for me, so change it a little to make the same goal possible another way, that's part of a development process right ?
Oh and Les, in case of the timer that will only switch for 1 minute. I can add some gears between the motor and the disc to make sure it can turn a section in a minute. Either with a stepper or using the Geneva mechanism as suggested by vu2nan.

At the moment, I do feel most for a microcontroller in combination with a stepper motor and RTC. In any case I'll order some parts and see how far I get with this, with the help of the script of Les, thanks !
If it doesn't work out, nice learning project for the future... and I'll opt for the earlier versions with the timer suggested by Les and if as you say it's possible to get it to work with a lower voltage that would be great. No problem for me opening it up, but if you could indicate on where to pick up the signal, that would be great.
Thank you so much for all the help so far !
 

LesJones

Joined Jan 8, 2017
4,511
Post #31 was the first time you mentioned a PC in the experiment. There is no RTC in the code that I posted in post #20. Adding this function to the code would require a display and buttons to allow it to be set. Another option to the display and buttons would be to set it using a PC via a serial link. (Hard wired serial link or Bluetooth.) This requires much more work in writing the code than the simple code in post #20.
Note. Lines 143 to 146 need removing from the code I posted. I added those lines to make it step every minute to check that it worked without waiting 9 hours.
Does the description of the sequence in post #20 meet YOUR ORIGINAL SPECIFICATION ?
The description of the experiment does help. I do not see the need for the 16 hour delay to allow the sequence to restart at the same time the next day. The sample taking just needs to stop after 8 steps. (Note the last stopping position will be for an unknown time unless the segment of the disk is covered after the last hour of exposure.) Your decription is very much like an automatic cat feeder that my sister uses when she is away from home. It might be worth looking at automatic cat feeders to see if any can be set to step every hour. ( I have just had a quick look at the rotating disk type cat feeders and they only seem to have about 5 sements to the disk so they would not be suitable.)
The only way I can see the code that I posted working is if 50 people each started their timers at the same time by their watch.

Les.
 

Ya’akov

Joined Jan 27, 2019
10,242
The only way I can see the code that I posted working is if 50 people each started their timers at the same time by their watch.
Les.
If cost isn’t an objection (it may well be) a GPS module would allow the clocks to be set automatically and have the quite possibly useful side effect of being able to record a position fix for the data.
 

LesJones

Joined Jan 8, 2017
4,511
I decided to reverse engineer the relay board from the type of timer that I suggeted.
Here is the schematic. Even with the 12 volt supply removed there is a signal available at the cathode of D2 that could be used to generate a pulse to step the motor past the micro switch (Or other sensor such as photo sensor, hall sensor, or magnetic reed switch. ) position. I have also attached the documentation that comes with the timer as a .pdf file.
Screen Shot 03-24-23 at 11.54 AM.PNGRelay PCB.jpgRIM00073.JPGThe voltage across DZ2 does not seem high enough to keep the rechargable lithium charged.

Les.
 

Attachments

Thread Starter

bjz

Joined Nov 13, 2017
11
Post #31 was the first time you mentioned a PC in the experiment.
In the way that you need a computer to program it, nothing will be connected to a PC during the experiment.

So as far as I understand, I've 3 options. Please correct me if I'm wrong.

1. I use the code you posted with a delay but as a start, so if it has to start at 9:00 in the morning, the experiment has to be setup 16 hours in advance. I could program batches of the setups with a different start delay so it's not necessary to set them up all at the same time.
Or, bring a laptop in the field and change the code and program it at the stop (if that's feasible).
2. Use an RTC, program it to start at 9:00 and sync the time and then setting up the experiments. I'll check out if adding a GPS would be worth it and falls withing the budget.
3. Use the timer in a way as you mentioned in post#27 (thanks for reverse engineering it !)

I'd prefer option 2 for user-friendliness. If the whole RTC thing gets too complicated to achieve, then I'll try option 1 or 3.
I'll order the various components and see how far I get with a prototype.

Thanks all !
 

LesJones

Joined Jan 8, 2017
4,511
Re post #37.
1 / The code that I posted does not have any code to provide an initial delay. I don't know how much experience with Atmel 8 bit assembly programming so if you are just learning it then it would be a good exercise to modify my program to include an initial delay. All the real work is done in the interupt handler. Most of the time it is in a tight loop of few NOP instructions doing nothing until a timer overflow interrupt occurs. Rather than having units programmed with different initial delays you could use one of the suggested timers to start the sequence by just using one of the available 16 timings events to power up the microcontroller to start the sequence of samples. ( This would NOT be as accurate as Ya'akov's suggestion of extracting time information from the GPS data stream but I think it would be within a few seconds per day.) I think the timer would be cheaper than a GPS receiver and consume less power.
2 / Writing RTC code would work but would take more time to write. Adding an RTC module such as a DS3231 to the microcontroller may reduce the amount of code that you would have to write. (I have considdered modifying some event monitors based on a PIC16F877 to use one of those modules to replace the RTC code that is being used at the moment.)

3 / I think using the suggested timer would be the cheapest and quickest solution. You would have to set the current time on the timer to start with. If you always started the sample collection at 09:00 then you would set timer event 1 to come on at 09:00 and off at 09:01. Timer event 2 to on at 10:00 and off at 10:01 and so on.
NOTE. If the disk has 8 positions you would only collect 7 samples as one position would be used before sampling started and after the last sample.

Les.
 
Top