Jump to content

Arduino stuff/ programing/so cheap


flyingbrick

Recommended Posts

  • Replies 416
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.

 

Link to comment
Share on other sites

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!!

Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 1 month later...

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!!

  • Like 1
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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,

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...