Hi everyone on picaxe forum!
I burned my first picaxe chip so I think this is the right moment for some educated help from fellow picaxers
Yes, I am a total noob when it comes to uCs, programming and whole IC field. I wanted to buy a module that does what I want it to do but to my surprise I only found out there is nothing like this out there. So I am trying to graduate in three complex areas in three weeks.
I want to let Picaxe listen for amplified audio signal through ADC on pin C.1. If bit value on ADC is below certain threshold then timer/counter starts and after 5 minutes or so it sets pin C.4 low.
Now the tricky part:
I know audio volume (dB) is logarithmic, not linear, like bit value on ADC reading (0-255: perfect even steps).
Multimeter revealed approx. this:
Volume min .I.........................................................................I. Volume max
AC(V)............ 0.2.....0.2x.....0.3.....0.4.........1.5.........3......5......8
When no song is playing, you can hear faint background noise from the speaker (which is ok) and voltage reads 0.2 V.
Unfortunately my Multimeter is not sensitive enough to tell me hundredths and thousandths of Volts AC. As you can see from the "picture", voltage goes up reluctantly and then goes up really fast just before hitting max volume. Here I burned my picaxe on those 8 volts . So my questions are:
1)How do I protect Picaxe from that high peek voltage(I want to retain as much sensitivity as I can so it could read those low V values as precisely as possible)? Or should I take care or that high voltage with resistor and program Picaxe to automatically adjust it's sensitivity on reading low value bit on ADC input?
2)Will it work with only one wire coming from amplifier to picaxe or do I need the other wire going also from amplifier to ground? The player/amplifier and picaxe share the same V0, but amplifier is powered by 18 volts and picaxe is powered with 5 V thanks to DC DC stepdown converter.
3) Do I need to use diodes since amplified audio is AC and not DC?
4) How to program it?
I want it to:
- listen for ADC continuously
- if ADC bit value is too low for 5 minutes, it puts pin C.4 low thus ending itself.
- if during that countdown it registers high bit value again (another song playing), it resets the timer
(By putting C.4 low the whole cirtuit shuts down by cutting power to itself so therefore that command is the last command of the program.)
Pseudo code:
Any suggestions? Ideas? I see the light at the end of the tunnel but also a lot of obstacles along the way.
Thank you all!
I burned my first picaxe chip so I think this is the right moment for some educated help from fellow picaxers
Yes, I am a total noob when it comes to uCs, programming and whole IC field. I wanted to buy a module that does what I want it to do but to my surprise I only found out there is nothing like this out there. So I am trying to graduate in three complex areas in three weeks.
I want to let Picaxe listen for amplified audio signal through ADC on pin C.1. If bit value on ADC is below certain threshold then timer/counter starts and after 5 minutes or so it sets pin C.4 low.
Now the tricky part:
I know audio volume (dB) is logarithmic, not linear, like bit value on ADC reading (0-255: perfect even steps).
Multimeter revealed approx. this:
Volume min .I.........................................................................I. Volume max
AC(V)............ 0.2.....0.2x.....0.3.....0.4.........1.5.........3......5......8
When no song is playing, you can hear faint background noise from the speaker (which is ok) and voltage reads 0.2 V.
Unfortunately my Multimeter is not sensitive enough to tell me hundredths and thousandths of Volts AC. As you can see from the "picture", voltage goes up reluctantly and then goes up really fast just before hitting max volume. Here I burned my picaxe on those 8 volts . So my questions are:
1)How do I protect Picaxe from that high peek voltage(I want to retain as much sensitivity as I can so it could read those low V values as precisely as possible)? Or should I take care or that high voltage with resistor and program Picaxe to automatically adjust it's sensitivity on reading low value bit on ADC input?
2)Will it work with only one wire coming from amplifier to picaxe or do I need the other wire going also from amplifier to ground? The player/amplifier and picaxe share the same V0, but amplifier is powered by 18 volts and picaxe is powered with 5 V thanks to DC DC stepdown converter.
3) Do I need to use diodes since amplified audio is AC and not DC?
4) How to program it?
I want it to:
- listen for ADC continuously
- if ADC bit value is too low for 5 minutes, it puts pin C.4 low thus ending itself.
- if during that countdown it registers high bit value again (another song playing), it resets the timer
(By putting C.4 low the whole cirtuit shuts down by cutting power to itself so therefore that command is the last command of the program.)
Pseudo code:
Code:
ADCmonitor:
Readadc pinC.1, b0
If b0 <= xxx then 'xxx=unknown threshold value
timer
timer = timer+1second
elseif
b0 > xxx then timer=0
Endif
If timer > 5minutes then
Low C.4
else
goto ADCmonitor
Endif
Thank you all!
Last edited: