Hey, so I've been working on an arduino project for a while now (MKR wifi 1010), and I just realized there's probably a much easier way to go about this all...
So here's the basic setup: I have a circuit with some dimmable LEDs, they have their own power supply, on/off switch and a dimmer that adjusts the voltage running through the circuit. That's all working great right now. What I'd like to be able to do is use the arduino to sense when current is flowing through that circuit (which could be anywhere from 2v to 12v) and when current is flowing, the arduino should send a message over wifi.
The programming part I think I have under control, but I'm realizing now just how little I know about electrical circuits/components.
TLDR:
So the question is, is there a simple switch that could be used to close a gate in circuit A (always 3.3v), when ever current is flowing through circuit B (anywhere from 2-12v)?
I guess while I'm at it, here's a secondary question: If I did want to power the arduino off of that first circuit with the LEDs (and I accept that the arduino is not going to be happy with less than 5v), is there a way to regulate that power down from (5v-12v) to a stable 5v?
Thanks in advance for any help people can offer!
when ever current is flowing through circuit B (anywhere from 2-12v)?
I think you are not understanding something about circuits. Current flows and is measured in Amps not in volts so that question does not make much sense.
If it is volts you want to measure then an analogue input with a potential divider to ensure the voltage does not exceed the Arduino chip’s supply voltage will do the job.
Or use a voltage comparator like the LM339.
Sorry but I don’t understand the rest of the question. A schematic would help sort things out if you could post one.
I think you are not understanding something about circuits. Current flows and is measured in Amps not in volts so that question does not make much sense.
Ok yes, I think "current" was the wrong word. I'm trying to test if a circuit is open or closed, while also not exposing pins on the arduino to the full 12v when the circuit is closed. (except the circuit isn't always at 12v when it's closed, it could be as low as 2v) I was also concerned that with a voltage divider, when the voltage was at the low end, it might not even detect that the circuit was closed. Maybe that's unfounded, I don't know.
Or use a voltage comparator like the LM339.
This looks like exactly the kind of thing I need! I had a suspicion there was a single component that did something like this. I'll probably be able to get where I need to with this.
Sorry but I don’t understand the rest of the question. A schematic would help sort things out if you could post one.
Yeah that's fair. What software do people tend to use for drawing schematics?
What software do people tend to use for drawing schematics?
We always recommend pen and paper, then post a photo of it. The main problem with software schematics is that they tend to not have the parts you want to draw and you end up putting the wrong part in which confusses the hell out of someone trying to use it.
(except the circuit isn't always at 12v when it's closed, it could be as low as 2v) I was also concerned that with a voltage divider, when the voltage was at the low end, it might not even detect that the circuit was closed.
Well to cut 12V down to 5V you have to use a voltage divider that reduces the voltage by 12/5 = 2.4 times.
So when the input is reduced to 2V this gives you 2/2.4 = 0.83 V.
Now the analogue to digital converter ( A/D ) on an Arduino is 10 bits which means it splits the input voltage into 210 = 1024 parts. Each part being 5 / 1024 = 0.0048V.
So when you have an input of 0.83V the reading will be 0.83 / 0.0048 = 172.9, but as it returns an integer and bearing in mind that there is a tolerance on the resistor's value will be close to 172, which is enough to measure.
Note that the LM339, or any chip you use will need powering with a voltage that is greater than the maximum voltage you are going to apply to any of the pins. So if you have not got a 12 supply in your system you might need a potential divider on that as well.
Awesome, thanks so much for all of that advice! I've been feeling like I'm totally flying blind, so this is super helpful.