cgriggry
Posts: 9
Joined: Fri Feb 07, 2020 5:37 pm

Acs712 current sensor

Tue Feb 18, 2020 6:57 am

Does anyone know how to hook up a acs712 current sensor to a raspberry pi 3? Does anyone also know any code to make the pi read the current sent in from the current sensor?

JohnsUPS
Posts: 188
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: Acs712 current sensor

Tue Feb 18, 2020 2:27 pm

The ACS712 sensor has an analog output, therefore, you will need to also use an analog-to-digital converter. The A-D will have a digital output that you can then send to the Pi.

There are many A-D converters out there that can be used. How much accuracy do you need? That will dictate the bit resolution of the A-D.

For the ACS712, you may not need anything more than 10 bits, as your accuracy will be limited by this device. An alternative is the INA260, which is a current and voltage sensor all in one package, and has a digital output (fewer total parts count - no A-D needed) so it can be connected directly to the Pi (so long as the device is powered from 3.3V).

cgriggry
Posts: 9
Joined: Fri Feb 07, 2020 5:37 pm

Re: Acs712 current sensor

Tue Feb 18, 2020 2:42 pm

I am using it to sense a light bulb to send an email, so I need it as accurate as I can get.

ElEscalador
Posts: 855
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: Acs712 current sensor

Tue Feb 18, 2020 2:49 pm

cgriggry wrote:
Tue Feb 18, 2020 2:42 pm
I am using it to sense a light bulb to send an email, so I need it as accurate as I can get.
You want to send an email when the light bulb comes on? There are far easier ways than an ADC. It might help us if you're a little more specific about what you are trying to do.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

cgriggry
Posts: 9
Joined: Fri Feb 07, 2020 5:37 pm

Re: Acs712 current sensor

Tue Feb 18, 2020 3:15 pm

Yes.

cgriggry
Posts: 9
Joined: Fri Feb 07, 2020 5:37 pm

Re: Acs712 current sensor

Tue Feb 18, 2020 6:22 pm

I am trying to send an email when a light bulb is turned on, and I am using the raspberry pi 3 and the acs712 current sensor.

JohnsUPS
Posts: 188
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: Acs712 current sensor

Tue Feb 18, 2020 11:03 pm

If that is all you need to do, then there are multiple other ways to do this. The simplest would be to use a light-dependent resistor/photoresistor. When light hits the LDR, the resistance decreases. Depending on your ambient light situation, minor additional circuitry might be needed.

Also, you could sense the voltage that is applied to the light bulb (if you know what you're doing when working with mains voltages if the bulb is so powered) instead of the current. An optoisolator would be needed to isolate the Pi.

There are also current transformers available, termed AC current switches, that incorporate a current transformer and a solid state switch that would be suitable for connection directly to a GPIO pin (a pullup resistor may be needed). The current transformer goes around one leg feeding the bulb, and will provide a contact closure output when the current passing through it is above a threshold.
https://www.nktechnologies.com/current- ... -switches/

Return to “Automation, sensing and robotics”