rusty360 Posted August 6, 2019 Share Posted August 6, 2019 5 hours ago, h4nd said: Looks OK, can you re-post as quote text please? Indent and spaces matter for python. Let me know if that still doesnt work. Quote Link to comment Share on other sites More sharing options...
h4nd Posted August 6, 2019 Share Posted August 6, 2019 Your switch pulls low, but you've got the interrupt triggering on RISING, (at the end (trailing edge) of the button press. This will be a bit later on, if the relay is holding for a while). Debounce is normally pretty short, 200ms should be plenty. If the relay is holding on for too long, you will just miss some of the 'presses'. Try putting an LED on the output to see how it's looking.That'll need solving first. In this case, you could replace the relay with: a small bridge rectifier, and a resistor to limit the current to about 20mA, and use an optocoupler (faster than a relay) just put the output of the optocoupler as your 'switch" the output is often polarised, but easy to figure out, and won't be damaged in your sensing circuit. Quote Link to comment Share on other sites More sharing options...
rusty360 Posted August 7, 2019 Share Posted August 7, 2019 2 hours ago, h4nd said: Your switch pulls low, but you've got the interrupt triggering on RISING, (at the end (trailing edge) of the button press. This will be a bit later on, if the relay is holding for a while). Debounce is normally pretty short, 200ms should be plenty. If the relay is holding on for too long, you will just miss some of the 'presses'. Try putting an LED on the output to see how it's looking.That'll need solving first. In this case, you could replace the relay with: a small bridge rectifier, and a resistor to limit the current to about 20mA, and use an optocoupler (faster than a relay) just put the output of the optocoupler as your 'switch" the output is often polarised, but easy to figure out, and won't be damaged in your sensing circuit. OK that makes some sense to a newbie. I thought because i was using a pull up resistor etc triggering on RISING was the way to go? should I be looking at FALLING then? Does the code look ok? Cheers for the info and help so far!! Quote Link to comment Share on other sites More sharing options...
Ned Posted August 7, 2019 Share Posted August 7, 2019 the pull up holds the line HIGH when the switch is open. Imagine the resistor is basically a spring holing the input signal high. Then when you press the switch, it pulls the line directly to ground, and the spring stretches. Then when you let go, the spring pulls it back high. So when you press the switch, it is the falling edge you want. 2 Quote Link to comment Share on other sites More sharing options...
rusty360 Posted August 7, 2019 Share Posted August 7, 2019 19 minutes ago, Ned said: the pull up holds the line HIGH when the switch is open. Imagine the resistor is basically a spring holing the input signal high. Then when you press the switch, it pulls the line directly to ground, and the spring stretches. Then when you let go, the spring pulls it back high. So when you press the switch, it is the falling edge you want. Thats a fantastic description, I will change the code to falling and see what happens! Im picking I just use the word FALLING? Quote Link to comment Share on other sites More sharing options...
Roman Posted August 8, 2019 Share Posted August 8, 2019 Teensy 4.0 is out. 600mhz arm cortex m7 and $19usd. Also friggen tiny. Ordered a pair, looking forward to having a hoon 3 Quote Link to comment Share on other sites More sharing options...
flyingbrick Posted September 15, 2019 Author Share Posted September 15, 2019 Dewalt battery charger. 150 to 200 bucks to buy outside of a kit but has 1% of the functionality of my cheap multifunction Ali express charger. The main thing i miss is a buzzer to say it's finished- i charge quite a few packs at night so it would be nice. Currently an LED flashes when charging and lights solid when complete. I planned to use simple switch debounce code and arduino to sound a buzzer when the led stops flashing. I stripped charger and wanted to check voltage of led during the charge cycle..but even touching one multimeter probe to one of the LED solder pads upsets its flash cycle- and at that stage i decided to re-assemble before i broke something. Does anyone have any idea what could cause this? Must be extremely sensitive circuitry!! 1 Quote Link to comment Share on other sites More sharing options...
Yowzer Posted September 15, 2019 Share Posted September 15, 2019 Why not just measure it when it's on solid? The voltage will be the same Quote Link to comment Share on other sites More sharing options...
flyingbrick Posted September 15, 2019 Author Share Posted September 15, 2019 Oh absolutely could, im just confused as to why its acting that way. Have never seen something so sensitive (except maybe the inputs on an arduino itself) Quote Link to comment Share on other sites More sharing options...
Yowzer Posted September 15, 2019 Share Posted September 15, 2019 The flasher circuit will be it's own little thing where it just charges and switches, trying to measure it adds more load which messes up it's charge time. IE it's just a dumb analogue flasher with no set frequency. 1 Quote Link to comment Share on other sites More sharing options...
Ghostchips Posted September 15, 2019 Share Posted September 15, 2019 8 hours ago, flyingbrick said: Dewalt battery charger. 150 to 200 bucks to buy outside of a kit but has 1% of the functionality of my cheap multifunction Ali express charger. The main thing i miss is a buzzer to say it's finished- i charge quite a few packs at night so it would be nice. Currently an LED flashes when charging and lights solid when complete. I planned to use simple switch debounce code and arduino to sound a buzzer when the led stops flashing. I stripped charger and wanted to check voltage of led during the charge cycle..but even touching one multimeter probe to one of the LED solder pads upsets its flash cycle- and at that stage i decided to re-assemble before i broke something. Does anyone have any idea what could cause this? Must be extremely sensitive circuitry!! Opticouple. Contains an LED. It might not might one being conected. Or put a photo-resister over the LED. I've done things like that but the calibration is hard to maintain. Phototransistor might work better. 1 Quote Link to comment Share on other sites More sharing options...
flyingbrick Posted September 15, 2019 Author Share Posted September 15, 2019 Good idea. One strange thing is that on the PCB and housing there are two LED's side by side. One only goes if there is a battery fault- that looks like a normal LED. The LED that I need to measure doesn't look like a normal LED and I just cant figure out why. Its round but has a flat top on it rather than a dome. Real weird. I think I'll just give it a hoon and see what happens when tapping direct to it. If not then use a light sensor... that would work well if I stick the sensor inside the case pointing at that LED. Cheers, Quote Link to comment Share on other sites More sharing options...
Roman Posted September 16, 2019 Share Posted September 16, 2019 4 hours ago, flyingbrick said: Good idea. One strange thing is that on the PCB and housing there are two LED's side by side. One only goes if there is a battery fault- that looks like a normal LED. The LED that I need to measure doesn't look like a normal LED and I just cant figure out why. Its round but has a flat top on it rather than a dome. Real weird. I think I'll just give it a hoon and see what happens when tapping direct to it. If not then use a light sensor... that would work well if I stick the sensor inside the case pointing at that LED. Cheers, Pretty sure LEDs adjust brightness by rather than adjusting voltage, using PWM to adjust current through to it. As they dont work at too low a voltage and too high they blow up. It might be that there's no on/off voltage but its just the PWM is so low that its "off" when its off Just a thought Quote Link to comment Share on other sites More sharing options...
Ashkellybarr Posted September 16, 2019 Share Posted September 16, 2019 2 hours ago, Roman said: Pretty sure LEDs adjust brightness by rather than adjusting voltage, using PWM to adjust current through to it. As they dont work at too low a voltage and too high they blow up. It might be that there's no on/off voltage but its just the PWM is so low that its "off" when its off Just a thought Could make a small recertifier circuit to smooth out the pwm Quote Link to comment Share on other sites More sharing options...
IvyMike Posted September 16, 2019 Share Posted September 16, 2019 Does the flash rate slow down? Total stab in the dark but I'd guess your multimeter probe is introducing some stray capacitance Quote Link to comment Share on other sites More sharing options...
flyingbrick Posted September 16, 2019 Author Share Posted September 16, 2019 14 hours ago, IvyMike said: Does the flash rate slow down? Total stab in the dark but I'd guess your multimeter probe is introducing some stray capacitance The flash sequence kinda stops and restarts. I tried probing the circuit last night to figure out if there was a place on the DC side of the circuit that i could power an arduino off. There is far more going on in this than i understand and the few areas i tried getting a voltage reading from REALLY upset things. EG, voltage would very quickly either increase or decrease once touching the probes. Apologies about my explanations, im no sparky lol. Iv put it back in its case now and will just use it as is (and maybe get a second charger @Roman) Quote Link to comment Share on other sites More sharing options...
IvyMike Posted September 17, 2019 Share Posted September 17, 2019 Could be a 555 flasher circuit or some other astable multivibrator. Pretty much what Yowzer described. Hard to know without seeing the layout. Quote Link to comment Share on other sites More sharing options...
flyingbrick Posted September 17, 2019 Author Share Posted September 17, 2019 Here's the same circuit with 110v input, 1 Quote Link to comment Share on other sites More sharing options...
Ghostchips Posted September 17, 2019 Share Posted September 17, 2019 If it's LED1 you're trying to connect to, that LDR idea i had might be easiest. Looks like connecting things to the LED makes that flasher circuit go nuts. I only know that because i built that flasher a a kid, the rest of the circuit is a bit above my pay grade. 1 Quote Link to comment Share on other sites More sharing options...
h4nd Posted September 18, 2019 Share Posted September 18, 2019 Remove LED1, install the LED (front end) of an optocoupler like the 817C's used elsewhere in the cct? Keep the wires short (wisted together is good). Use a soft bias on the Arduino (like the input pullup mode, ~50kOhm). Add 1nF on the output for noise reduction. ???? Profit. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.