I want to make a strobed water fountain as a project.
First an apology to mkstevo for posting on his project,
I thought he would be interested. Anyway..
It needs a pump and water .. sorted.
It needs a variable strobe. This works.
This gives a variable frequency strobe over a few Hz. around the frequency the water drops
BUT it's a stand alone program.
searching for info about strobe fountainis incomplete.
I should use a solenoid valve running under pwm it seems to control water droplets size.
Well.., a 12V solenoid valve is mechanical and the strobe is around 50Hz. so it's pwm is 50Hz.
This works for 50Hz. pwm for the solenoid.
A pot connected to portc.1 changes the portd.6 on time..
ie. the valve on/off time and so the droplet size....in theory :)
Trouble is I can't join the two programs to make one. 2 evenings and no luck.
It's the variable strobe that is giving me gip. It's very interesting but a bit frustrating.
I think another approach is needed. Any suggestions welcome.
I think looking at the interrupt demos again might help.
I don't really understand wait or pulseout.
I know interrupts still run while wait is running. Not sure about pulseout.
White leds for the strobe.
only on for 1mS every 20mS so 0.05 % the power...
so run at 6V.
I digress. I have a lamp that came from a shop where everything is £1.
72 leds in parallel running straight off 4 x 1.5V AA cells.
I noticed the battery voltage dropped to 3.6V.
At 50Hz they could run at 6V maybe? ... all part of the project.
I sent off for 100 white leds.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After too many hours trying, I am back at my original code for a strobe from 45 to 53 Hz
I will use 2 arduino nanos..one for the strobe frequency and another for the valve 50Hz on time.
I spent too long getting it to work on 1 uno.
I found using 2 timers seems to work. Pity interrupt values are not variable or maybe they are.
I finally joined the variable 46Hz to 54Hz 1ms pulse strobe and the pwm for the solenoid valve
which is on for 1ms to 19ms every 20ms.
I used an every 1ms timer0 interrupt for the valve...
which runs during the main do wait pulseout loop.
#chip mega328p,16
#option explicit
#define valve portd.6
#define strobe portd.7
#define drop_size_pot portc.0
#define strobe_pot portc.1
dir valve out
dir strobe out
dir drop_size_pot in
dir strobe_pot in
dim valve_pot_val , mills_counter , strobe_pot_val as byte
;-------------------------------;start 1ms interrupt isr
On Interrupt Timer0Match1 Call valve_isr
Dim OCR0 AS byte alias OCR0A
Dim TCCR0 AS byte alias TCCR0B
WGM01 = 1
OCR0 = 249 ;1ms
TCCR0 = 0x28
TCCR0 = TCCR0 or 0x03
'--------------
do
;read strobe pot
strobe_pot_val = readad (strobe_pot)
wait 17300 us
wait strobe_pot_val 10us
pulseout strobe,1 ms
;read valve pot
valve_pot_val = scale(readad (drop_size_pot),0,255,1,19)
loop
;---------------
Sub valve_isr ;called every 1mS
mills_counter ++
if mills_counter = 20 then
mills_counter = 0
set valve on
else if mills_counter = valve_pot_val then
set valve off
end if
End Sub
I want to make a strobed water fountain as a project.
First an apology to mkstevo for posting on his project,
I thought he would be interested. Anyway..
It needs a pump and water .. sorted.
It needs a variable strobe. This works.
This gives a variable frequency strobe over a few Hz. around the frequency the water drops
BUT it's a stand alone program.
searching for info about strobe fountainis incomplete.
I should use a solenoid valve running under pwm it seems to control water droplets size.
Well.., a 12V solenoid valve is mechanical and the strobe is around 50Hz. so it's pwm is 50Hz.
This works for 50Hz. pwm for the solenoid.
A pot connected to portc.1 changes the portd.6 on time..
ie. the valve on/off time and so the droplet size....in theory :)
Trouble is I can't join the two programs to make one. 2 evenings and no luck.
It's the variable strobe that is giving me gip. It's very interesting but a bit frustrating.
I think another approach is needed. Any suggestions welcome.
Last edit: stan cartwright 2020-07-15
I think looking at the interrupt demos again might help.
I don't really understand wait or pulseout.
I know interrupts still run while wait is running. Not sure about pulseout.
White leds for the strobe.
only on for 1mS every 20mS so 0.05 % the power...
so run at 6V.
I digress. I have a lamp that came from a shop where everything is £1.
72 leds in parallel running straight off 4 x 1.5V AA cells.
I noticed the battery voltage dropped to 3.6V.
At 50Hz they could run at 6V maybe? ... all part of the project.
I sent off for 100 white leds.
After too many hours trying, I am back at my original code for a strobe from 45 to 53 Hz
I will use 2 arduino nanos..one for the strobe frequency and another for the valve 50Hz on time.
I spent too long getting it to work on 1 uno.
I found using 2 timers seems to work. Pity interrupt values are not variable or maybe they are.
I finally joined the variable 46Hz to 54Hz 1ms pulse strobe and the pwm for the solenoid valve
which is on for 1ms to 19ms every 20ms.
I used an every 1ms timer0 interrupt for the valve...
which runs during the main do wait pulseout loop.