Hi
I have a student project at year 7 making the same knock box discussed on the forum, also on instructables, but using 4.5v instead of 6v.
A piezo responds to knocking, stores the count and the duration between, then controls a small motor with a weight to repeat the pattern.
It functions, but the voltage is so low through the mosfet switch that the knock is too weak
the original plan used 6v dropping to 4.5 thru signal diodes for the 08m2, but keeping the full 6v at the motor.
Because Im using 4.5v I tried dropping to 3.75v to the 08m2 to get the voltage difference for the mosfet but no change at the motor.
the circuit diagram attached is the copper foil cut I'm using for students to solder to, I hope you can decipher it
Question
How can I get the full 4.5V at the motor thru the mosfet... at present it shows less than 1v on the meter.
thanks for any help
I have a student project at year 7 making the same knock box discussed on the forum, also on instructables, but using 4.5v instead of 6v.
A piezo responds to knocking, stores the count and the duration between, then controls a small motor with a weight to repeat the pattern.
It functions, but the voltage is so low through the mosfet switch that the knock is too weak
the original plan used 6v dropping to 4.5 thru signal diodes for the 08m2, but keeping the full 6v at the motor.
Because Im using 4.5v I tried dropping to 3.75v to the 08m2 to get the voltage difference for the mosfet but no change at the motor.
the circuit diagram attached is the copper foil cut I'm using for students to solder to, I hope you can decipher it
Question
How can I get the full 4.5V at the motor thru the mosfet... at present it shows less than 1v on the meter.
thanks for any help
Code:
#picaxe 08m2
'setfreq m4 'Not necessary at 4MHz - Saves 4 bytes
' Assign names to pins, variables to registers,and constants.
symbol rnd = w6 'Word variable : Current random number
symbol kdel = w5 'Word variable : Delay between last and current knock input
symbol cnt1 = b0
symbol kcnt = b1 'Number of knocks
symbol pptr = b2 'Pointer to knock delay storage array
symbol tmp1 = b6 'Reusable variable
symbol tmp2 = b7 'Reusable variable
symbol mic = Pin1 'Microphone input (can also be output)
symbol spkr = pin2 'Lautsprecher
symbol knock = 4 'Knock motor output
symbol led = 0 'Indicator LED for testing
symbol pstart = $50 'Start of storage area
symbol tmax = 1000 'Time-out value for delay - About 1.5 seconds
symbol settle = 80 'Settling time for microphone
' This section is where the person knocks.
' The time between successive knocks is stored
' until there is a pause of 1.5 seconds or so.
do 'Start of main loop
kcnt = 0 'Initialise knock counter
input 1 'Define mic as input to detect knocks
sertxd ("ready for knock ",13,10)
do
for kdel = 1 to tmax 'KDel is counting loops to determine time between knocks
if mic = 1 then 'Detect HI on microphone input
sertxd ("detecting mic ",13,10)
inc kcnt 'Add 1 to number of knocks
high led 'Flash LED to help debugging
pause settle 'Wait for oscillations to stop
low led
kdel = kdel + settle 'Add settle time to loop counter for accuracy
pptr = kcnt * 2 + pstart'KCnnt is a word variable so need to add 2 to pointer
poke pptr,word kdel 'Write the delay from last knock to storage area
kdel = 0 'Reset kdel ready for next knock
end if
next kdel
loop until kdel >= tmax 'If no knocks for over TMax loops then leave loop
'This section will operate sepending on the number of knocks detected.
'If there are no knocks it will exit.
'Other things happen on 13 or 20 knocks, or it will echo the knocks for any other number.
'The maximum number of knocks is 23 to fill buffer. Incorrect count after that.
select case kcnt
case 0
sertxd ("waiting for knock ",13,10) 'Do nothing if no knocks have occurred
case 20 'If 20 knocks play go into prank mode
gosub twoknock
wait 30 'Do nothing for 30 seconds
for tmp1 = 1 to 50 'Make 50 knocks with random spacing
random W6 'Generates next random word
tmp2 = rnd + 100 'Make delay value from random value
gosub doknock 'Make a knock
pause tmp2 'Pause for the random delay number of milliseconds
next tmp1 'Loop until 50 knocks done
case 3
sertxd ("doing crazy stuff ",13,10) 'Piecax's favourite number
high knock
pause 200
low knock
pause 300
high knock
pause 200
low knock
pause 300
high knock
pause 200
low knock
pause 300
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high knock
pause 200
low knock
pause 300
high knock
pause 200
low knock
pause 300
high knock
pause 200
low knock
pause 300
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
high c.2
pause 100
low c.2
pause 100
else 'Any other number of knocks will be echoed
sertxd ("responding to knocks ",13,10)
for tmp1 = 1 to kcnt 'Loop for the number of knocks
pptr = tmp1 * 2 + pstart 'Step in twos through buffer
peek pptr,word kdel 'Read back delay value words from buffer
pause kdel 'Wait the delay time (in milli-seconds)
gosub DoKnock 'Perform a knock
next tmp1 'Loop for next knock
pause 200
endselect
loop
' This section contains the knocking routines
DoKnock:
high led 'Turn on LED
high knock 'Turn on motor
sertxd ("moota on",13,10)
pause 100
sertxd ("pausing",13,10) 'Wait 100 milli-seconds was 70 before
low knock 'Turn off motor
sertxd ("moota off ",13,10)
low led 'Turn off LED
return
TwoKnock: 'More compact to do this as subroutine
pause 580 'Two knocks with timed delays between for tune
gosub doknock
pause 730
gosub doknock
pause 730
return