Newbie Question About Hooking up to a Sensor

Tags: #<Tag:0x00007fe220782ee0>


Hi All,

Happy Holidays everybody!

I’ve got a newbie question. I think it’s mostly a newbie electrical question though. I have an Electron that I’m trying to hook up to the output of a flow meter. The flow meter has 4 digital outputs. I’d like to try to hook into these if I can. The flow meter is a ModMag 2000 by BadgerMeter. (

From Page 16 and Page 17, I see that the voltage on the active digital outputs is 24v. I can’t hook the Electron up directly to those signals or it will fry them, right?

I believe I need to get some sort of converter or module (something like this to step the signal voltage down from 24v to 3.3v.

So I’d wire the loop from my flow meter into the inputs of the step down module, then I’d wire the loop on the Electron side to the outputs of the module? Then I’d need to figure out the conversion between the higher voltage/amperage side and the lower voltage size.

and since the Digital pins are either on or off, that should be all I need, right?

Is that right?

Is there an easier way to get the voltage from 24v down to 3.3 without hooking up a step down module? or am I looking at this all wrong?


You definitely do not want to use a DC DC converter.

Looking at your M2000 boards comms options the most likely you will be using is RS485 MODBUS - you can’t directly connect this to the Electron - what you will need is a RS485 to TTL converter. These are cheap and will isolate the electron from the 24VDC on the RS485 bus and allow you to use a couple of pins as data in and data out. You will also need a control line pin. The driver software for the RS485 is effectively a wrapper around the and Serial.write() - have a look in the . You will then need to look at the protocol used by the flow meter to determine how to read the flow rate from the modBus.


The outputs also support a passive mode where the internal 24VDC are not applied to the output when the respective jumpers JP1 & JP2 are not set.

This way you are supplying the sensing signal via a pull-up resistor to terminals 1 & 3 and can sense active-low for the raw pulse signals.
ModBus, RS232 and other higher level protocols would be exposed via the comms daughter board.

How long will your wires between the meater and your Electron be?


Thanks ScruffR,

The wires between Electron and the output connectors will be mere Inches. I plan to put the particle board inside the amplifier housing, or worst case, as a bolt on container just on the back of the housing.

Lemme look at that bit about the jumpers again. I think I see what you mean. If I put a pull-up resistor between 3v3 and terminal 1, the set my pulse width to 1 second via the config panel, and set my read interval in the electron app loop to 1 second, then for every unit (I’ll be using Barrels) that passes, it will pulse. that will bring my digital input value to 0 volts, and I can read that. so a 0 value on my pin would indicate a pulse from the meter. Do I have that correct?


thanks for the info Armor. I’m pretty sure I won’t be using the RS485 interface.

I’ll either connect to the digital outputs or the analog output. However, you bring up an interesting point. I would imagine there are existing bits of hardware or designs that would allow RS485 to talk to Particle boards. I’ll give the a Google, just to see what comes up.



Are you trying to read the 4-20 mA from the flow meter? I have used devices from National Control Device to interface to 4-20 mA devices in the Water/Waste Water industry. I’ve also had them layout a couple of custom pwbs using the Particle devices for control. Also there are boards (DF Robot) that take 4-20 mA signals and convert them to voltage (0 - 3.3 vdc) so you could bring them directly into the Electron.
I also have a device that interfaces to VFDs using RS-485 if you want to go that route.
I have plenty of code that I can send you if you are interested.

Best Regards,


Thanks for the heads up Dave.

I was not aware of the NCD site til just now. I’m REALLY a newbie at this. Lots of really cool stuff on that site. I think I’m going to end up going with ScruffR’s recommendation for the pull-up resistor and using the passive output signal from the Badger. I really only need the pulsed totalizer capability of the meter (at least right now) so that seems like the simplest solution.

The only uncertainty I have right now is how to patch the actual signal circuit from the Badger into the signal circuit on the Electron such that when it pulses, it will ground out my signal circuit to pull the voltage down.


How are you powering the Electron (USB, Vin or LiPo only)?
In the simplest form, you’d attach the Vin (or 3v3 in case of LiPo only) pin via a resistor (e.g. 10k) to pin 1 or 3, connect your sensing pin to 1 or 3 directly and finally tie the Electron’s GND pin to 2 or 4.

Don’t use analogRead() nor INPUT_PULLUP on your sensing pin when pulling up to 5V (Vin).

For a safer version you could use an opto isolator to decouple the Electron from potentially harmful voltages (e.g. when you forget to remove the jumpers :wink: )


I very much appreciate your feedback ScruffR.

The plan is to power the Electron via Vin from mains power. The Electron itself will need to be running 24/7 with no sleep time. I was hoping I could piggy back off the power supply coming out of the converter on the meter itself (85-265 vac input), but I don’t see any places to patch into it. It also occurred to me that that circuitry is probably not wired to support another 10W load on it, so I’m concerned I might burn something up.

It looks like I will need to power it separately. It seems like an on-board or other small form factor converter that will take me from a similar vac input range (85-265) down to 12v or 5v dc is the way to go.

From reading the Electron docs, I need one that will supply 10w, so I guess I need one that will be able to give me 12v@85mA, or 5v@2A. I’ve been looking for a couple days now. I’ve found some that will take an input vac of 90-265vac and output 5V dc, but at only 1 amp ( I’ve also found some that are on-board mounted converters and have a wide range for voltage in, but spit out 5v @ 2A. ( This one looks like it would work for me.

I see some stuff on ebay, but not sure about the quality or how to assess. For instance, this one looks promising.

I’m wondering if anybody has any suggestions for other brands or models?


What 10A load are you talking about?

(scrap that 24 VDC Supply mode - I just realised that can only drive 50mA)

But when you going after mains supply you should only do that when you know what you are doing!
It may be against your local regulations and/or violate your insurance policy if you use uncertified equipment.

Having said that, when supplying power to the Electron via Vin without a LiPo installed, you need to make sure your supply can deliver the required current fast and clean.
So filter and buffer caps need to be fitted and allow for some extra margin on the current side.

This should probably be 850mA but I’d go for 1A@12V to allow for some loss due to lower efficiency when spanning a larger gap from 12V to 3.3V the device actually needs. Your external converter may also have poor efficiency during low load periods adding to the lag when the demand spikes due to cell communication.


oops. I meant 10W, not 10A. my bad.


so maybe I would be better of going with something like this: and an off the shelf converter like this?


These are definetly certified, but you should also be able to use a quality 2+A@5V micro USB supply and add some buffer and filter caps to Vin.


wouldn’t a quality micro USB supply have a filter cap built into it already?

I also had another idea. I plan to leave the battery attached to the Electron, just not use a solar for charging. It seems that it would work just fine to use the USB port that’s on the electron to power the board? I could get an off the shelf USB supply like you mentioned, and instead of powering via Vin, just plug it into the USB port on the Electron. That should work right? And it makes everything simple?


When you have the LiPo attached you can opt for a cheaper USB supply but not the really cheap stuff that comes with a lot of noise and ripple. This would most likely reduce the lifetime of the onboard regulator.


@oildatatech, are you sure that your Meter is powered by AC ?
We normally see a DIN rail mounted 24V DC power supply used with these types of meters.
If that’s what you have, then the NCD board will work fine, with nothing else required.

If the meter is in-fact AC powered, is there a convenience receptacle nearby for a “Wall-Wart” AC/DC adapter for the NCD board ?


if I’m reading the manual correctly, the meter will take an AC input (85-265 volts) or DC input (10-36v). For our particular application, we’ll be using some sort of mains voltage. That’s kind of an open question right now. We know it will either be from the grid or from some sort of light plant on site. it’s going to be site specific. For now, I’m building it to deal with mains voltage since I believe that will be the vast majority of our cases.

When you ask if there is a convenience receptacle nearby, are you referring to inside the meter’s amplifier and circuity enclosure/housing, or are you referring to something external to the entire meter assembly?