Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Arduino "HIGH/LOW" dc voltage detection with "digitalRead()"

Status
Not open for further replies.

codemaster11

Advanced Member level 4
Joined
Sep 2, 2019
Messages
115
Helped
9
Reputation
18
Reaction score
7
Trophy points
18
Activity points
1,218
i want to find whether a digital pin of arduino let say digital pin#4 is "HIGH or LOW" using a voltage divider resistor.
just as "analogRead()" that the voltage sense divider network & arduino must have common ground, is it also necessary for
digitalRead() that the "HIGH/LOW" detection divider network & arduino must have same common ground?

Capture.JPG


if to consider that divider network & arduino pro mini have different ground then is it possible for pro mini to detect HIGH/LOW voltage at
4k7 resistor as in picture above.
 

It can only sense voltages between its input and ground pin so either you connect the grounds together or you employ some extra circuitry that can use two different ground references. The circuit to do that will depend entirely upon the application, there is no generic solution.

Be careful, if there is a voltage between GND1 and GND2 it could be sufficient or the wrong polarity to damage the Genuino board.

Brian.
 

One possibility to achieve isolation is photo coupler -



Its error (for 201) is 5% if thats tolerable. You could do a cal routine in which
you transmit a control signal across barrier with another LED/photo coupler
and force a known current on signal origin side into LED, measure output,
and use that as a correction factor.....


Regards, Dana.
 
Solution
pc817 isolated GND..gif


as suggested in post#3 for isolating grounds & transforming signal from one side to other this circuit has solved my problem
off sensing HIGH/LOW voltage at the led side. now turing the IR led of photocoupler will make the logic state HIGH/LOW in case power
is present at IR led side.

thanks
danadakk

 

if you are detecting power good derived from a micro sending logic output
keep in mind as a micro is being powered up most have a range of supply V
where outputs are undefined. So in code you might qualify the test with
several "reads" over time, like in debouncing a push button, and if reads
satisfy the condition for those sequential reads then a legit value is established.


Regards, Dana.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top