jeffrutland
Posts: 5
Joined: Mon Dec 09, 2019 10:06 pm

Current sensing question

Mon Dec 09, 2019 10:17 pm

Hello,

I'm a bit of a pi hacker, and while I'm clever with HATs and software, I'd like to detect when an appliance (a garage heater I installed) turns on and off. I started researching current sensing units, and ultimately purchased this one:

https://www.amazon.com/gp/product/B07JN ... UTF8&psc=1

The heater I installed is 220V and runs at 21A max. I have access to the supply wires as I installed it myself, and there's room the base of the heater for me to install this sensor, or something similar. When I discovered this sensor, in my mind it 'worked' - so I ordered it. Now that I have it in my hands, I am not sure about how to move forward with this project. I see other current sensing questions posted here, but I guess I'm looking for a specific example of how to employ a device like this connected (somehow) to GPIO and perform these detections.

Can anyone give me a link to an example project using one of these and how it's done? Or some helpful hints here? Thanks!

klricks
Posts: 7301
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Current sensing question

Tue Dec 10, 2019 3:18 am

You will need an analog to digital converter of some sort.
In your Amazon product page link, look at the picture with the Raspberry Pi... There is a board attached to the RPi.... That is what you need.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

jeffrutland
Posts: 5
Joined: Mon Dec 09, 2019 10:06 pm

Re: Current sensing question

Tue Dec 10, 2019 2:11 pm

After digging around a little, wouldn't something like this work? Or am I making this too simple?

https://www.amazon.com/Current-Sensing- ... 92751ZBKY9

If that's a switch that simply closes when current is detected, couldn't I use the Pi's 3.3v and send it to a GPIO pin and detect when voltage is present on that pin - the voltage from the Pi itself? I'd rather not make a whole board of external components to do this if I can get away with it.

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

Re: Current sensing question

Tue Dec 10, 2019 2:56 pm

A couple of thoughts: Is it important to you to do this by sensing current? If so, either device you listed should work if you clamp it on the correct wire. I'd go with the fan wire (gas heater?). My second thought is do you want proof of heating happening? Or just proof that heat is being called for? Or just proof that the unit is trying to run? Those are three separate problems. The simplest thing I would do is (assuming gas heater) is put a relay with the coil in parallel with the gas valve then just monitor the contacts. That covers that heat is being called for and the unit is most likely running. To be sure the unit is running and easier than sensing current, I'd use two ds18b20 temp sensors and check for a temperature differential on the air going in and out.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

jeffrutland
Posts: 5
Joined: Mon Dec 09, 2019 10:06 pm

Re: Current sensing question

Tue Dec 10, 2019 9:47 pm

My total situation is this:

I have a Pi Zero in the garage with a Pimoroni EnviroHat on it. It is logging temperature readings in the garage to a Maria DB I host on a Synology NAS. The heater that I have installed is electric (220v) and also has a thermostat on it - so I don't know when it's running, and when it's not. Sensing current on the electrical line to me seemed like the easiest option, having the Pi also monitor GPIO for when this happens. I thought about some type of photo sensor, but there isn't a light that illuminates when the heat is on or off.

What I'm trying to avoid is having a breadboard of sorts with extra components hanging around. If a GPIO pin is used to detect the presence of voltage, why can't I use the 3.3v supply from the Pi itself to send out to the current sensing switch, then back to a GPIO pin with the switch inline to complete the circuit? I've never used GPIO before, hence my asking if there's a simple example around for me to put together, I could get my head around it.

The second product I linked in this thread appears to be a simple switch that gets tripped when the device detects current. The first one is more reliant on induction, and I would have to make some sort of sense of the voltage on the line. I figured a switch would be easier, but again... newbie here.

jeffrutland
Posts: 5
Joined: Mon Dec 09, 2019 10:06 pm

Re: Current sensing question

Tue Dec 10, 2019 9:54 pm

Now that I've googled a bit more, it seems like this right here would work - replacing the physical switch with the current sensing switch I linked:

https://raspberrypihq.com/use-a-push-bu ... y-pi-gpio/

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

Re: Current sensing question

Tue Dec 10, 2019 11:13 pm

Ah, yes. With that extra info it sounds like you are on to about the simple solution.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

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

Re: Current sensing question

Wed Dec 18, 2019 1:18 pm

ElEscalador wrote:
Tue Dec 10, 2019 2:56 pm
A couple of thoughts: Is it important to you to do this by sensing current? If so, either device you listed should work if you clamp it on the correct wire. I'd go with the fan wire (gas heater?). My second thought is do you want proof of heating happening? Or just proof that heat is being called for? Or just proof that the unit is trying to run? Those are three separate problems. The simplest thing I would do is (assuming gas heater) is put a relay with the coil in parallel with the gas valve then just monitor the contacts. That covers that heat is being called for and the unit is most likely running. To be sure the unit is running and easier than sensing current, I'd use two ds18b20 temp sensors and check for a temperature differential on the air going in and out.
This is the simplest way to do the monitoring. Get a small relay that has a coil winding rated for the voltage across the gas valve, then use the relay contacts to close a connection between a GPIO pin and 3.3V or ground (depending on how you want your signaling polarity).
Adding a temp sensor would be a nice enhancement to the relay.

Return to “Automation, sensing and robotics”