Hi all, I’ve been reading a bit and want to start logging our energy consumption with the minimal amount of new hardware.
Currently I have a Mac running as a server, physically very close to our utility meter.
There seem to be a few different USB connected breakout boards available, but I’m having trouble telling if these boards will enable me to get input readings from the optical pulse sensor via an USB connection.
I’d say using an Arduino to read the pulses by interrupt then send the number of pulses over serial at whichever frequency you like.
I think you will need some kind of microprocessor independent of your mac to do this easily.
A long shot would be hacking an input on the mac and reading the pulse value. Perhaps some code to read the microphone jack input.
Recently I discovered the emonTH can accept these pulse inputs, so you could have pulses, temperature and humidity all in one sent over serial with your FTDI adaptor, possibly you’d need some minor changes in the firmware, I’m unfamiliar with the TH’s firmware, it might already be set to send data over serial.
That’s right. The temperature sensor in the instructable article is capable of digital communication. The optical sensor is old skool analog. Roughly speaking, low output in low light, high (near Vsupply) output in full beaming light.
Hence, you probably need an intermediary microprocessor like an arduino.
It’s understandable where the question comes from. RJ45 is a physical plug/socket standard.
What signal type the RJ45 is carrying through it could be any of the myriad of digital or analog varieties, for example ethernet.
The device being connected (the sensor) is in fact a 3 wire analog device.
The RJ45 was chosen on the Tx for convenience as the sensors come shipped with an RJ45 plug.
You could if you like, cut the plug off the sensor, and connect the three wires what you like. They’re Vcc (up to 5v), signal, and GND.
If you can read individual bits, individual 1s and 0s from the serial adaptor, you’ve got a chance. That might be worth a look. My understanding is that normal serial comms works in handshaked bytes, not bits, so it wouldn’t be a standard thing, to read the high and low of a sensor like this.
To flesh that out a little more, the optical sensor doesn’t send a message, like the character ‘1’ meaning “I see light” or the character ‘0’ meaning “It’s dark”, it generates a voltage. If your serial adapter transmits the control lines (DTR, DSR etc) and those can be read at the receiving end (the old AT command set maybe?), then you might be able to use that and you stand a chance. Otherwise as @danbates said earlier, you need a small processor to see the change in voltage and generate a suitable message that your Mac can receive and do something useful with.
Exactly. If you can find a way to read the digital state of these on the serial adaptor then you’ve got a chance.
If you’ve got the drive to make it work have a look at python-serial modules. A script could be written in python (or your language of choice) to read the state of the control or reset lines of the serial adaptor.
Thanks again @danbates & @Robert.Wall for bearing with me. It’s clear that I need a microcontroller to convert the analog “signal” into digital values.
Any suggestions or preferences in hardware? Reading around, just an Arduino won’t do as it’s not a “USB host”. I will need additional hats etc?
What do you think about the specs of the following boards for the task at hand?
They both have analog input pins and the correct voltage available for the sensor. But I’m not sure if the Trinket (first board above) will enable me to get real-time signals via USB.
An Arduino will work, for example the Uno, Nano or Micro, as will both of those with some extra work.
Seems like you’ll have to take a leap and try get something working!