Raspberry Pi and FTDI USB (or Serial)

For more advanced meter data users. Learn from others and ask questions about how to read meters, how to use the EKM Push Data, and how to display the meter data in useful ways.
Post Reply
flyrjh
Posts: 3
Joined: Wed Nov 19, 2014 8:58 pm

Raspberry Pi and FTDI USB (or Serial)

Post by flyrjh » Wed Nov 19, 2014 10:25 pm

My goal: Read my OmniMeter v4 from a Raspberry Pi, either with the FTDI/USB adapter, or the serial converter. I have both, USB would be preferred but either is fine.

I have read for hours on this forum, and there's a lot of great information, but I'm not having much success yet.

Could anyone point me in a more productive direction? I'm about ready to buy an iSerial and just try that code, as I've seen several examples that look workable.

C, python, and shell are all very familiar, although maybe rusty at times. I have tried reading and writing in each with no luck; I understand 7-E-1 can be a problem but I've done my best to set these, seems really hard to debug when you're just getting nothing back.

If I could at least get some data from the device I could look into the algorithms scattered in the forum.

Thanks for any advice or pointers,

Joe

flyrjh
Posts: 3
Joined: Wed Nov 19, 2014 8:58 pm

Re: Raspberry Pi and FTDI USB (or Serial)

Post by flyrjh » Wed Nov 19, 2014 11:01 pm

Well, after posting this I'm finally getting data in C. I think it was just missing O_RDWR. Hopefully over the next few weeks I can get it parsed and post some sample code, curious how many people might be interested. Looking forward to rrdtools next! And maybe posting to a google spreadsheeet, we'll see. -Joe

Jameson
Posts: 749
Joined: Fri Nov 04, 2011 7:42 pm
Location: Santa Cruz, CA
Contact:

Re: Raspberry Pi and FTDI USB (or Serial)

Post by Jameson » Thu Nov 20, 2014 9:37 am

Hello Joe, Welcome to the forum!!

Very cool to hear about your raspberry pi project. That would be great if you wanted to post your code here for others to take a look at and/or contribute to.

Here is a discussion on the forum that somewhat relates to the raspi: http://forum.ekmmetering.com/viewtopic. ... erry#p3429

My recollection is that he had quite a cool setup. We are interested in a standalone, low power, data logging solution (to an SD card or dropbox folder) that the raspberry pi could potentially provide.

I am curious to follow your progress :D
Jameson
EKM METERING
http://www.ekmmetering.com
831.425.7371

flyrjh
Posts: 3
Joined: Wed Nov 19, 2014 8:58 pm

Re: Raspberry Pi and FTDI USB (or Serial)

Post by flyrjh » Thu Nov 20, 2014 6:39 pm

Jameson, thanks! I've been looking forward to this step for many months, and reading many of your very kind replies.

What I've done is to write a little C program that reads USB/RS-485 data, and prints the parts I wanted. Then, I have a shell script that calls it every minute, parses the output, and calls the wattvision API to let them handle graphing. Google docs would be easy enough; or dropbox, but for mine I'm writing to a local SAN, just an old hard drive, to avoid wearing out the SD card over the next few years.

I found a RasPi site that gave me a good start at reading RS-485, which turns out to be fairly simple with your USB dongle. Then, I found some v3 struct code on the EKM forum here, and I updated that to the v4 specs. Finally I put the CRC bits in, un-swapped the endian bits from the other system's code, and it actually verifies.

So it's a fairly simple setup; no iSerial required, and it's been running all day now without any hiccups. It can query up to twice per second if you put it in a tight loop, far more than most people should need. (another post)

There's yet another post I ran across that's using rrdtools for graphing that I'd like to try next, since wattvision only does power and I want to add water and gas. Looks like he was using iSerial too.
http://forum.ekmmetering.com/viewtopic. ... =rrd#p5970

I'll try to clean the code up over the next few days and post more progress. Thanks for the encouragement, if I hadn't read your past interest I might not have been so persistent last night!

Joe

Jameson
Posts: 749
Joined: Fri Nov 04, 2011 7:42 pm
Location: Santa Cruz, CA
Contact:

Re: Raspberry Pi and FTDI USB (or Serial)

Post by Jameson » Fri Nov 21, 2014 12:20 pm

Hi Joe,

Yes we are super encouraging of this kind of project. Our philosophy is: the more ways our users can access their meter data the better.

Yeah teaming up with what he has here: http://forum.ekmmetering.com/viewtopic. ... erry#p3429 could be a match made in heaven. :mrgreen:

I would love to see how your water meter and gas meter graphs turn out!

Thanks again,
Jameson
EKM METERING
http://www.ekmmetering.com
831.425.7371

advansis
Posts: 2
Joined: Fri Feb 06, 2015 2:51 pm

Re: Raspberry Pi and FTDI USB (or Serial)

Post by advansis » Wed Feb 18, 2015 10:31 am

Hi Joe
How's progress? I'd love to hear more about your setup

vintozver
Posts: 1
Joined: Tue Oct 23, 2018 3:48 pm

Re: Raspberry Pi and FTDI USB (or Serial)

Post by vintozver » Tue Oct 23, 2018 3:58 pm

I have a production setup. I used Andino Pi (Raspberry Pi 3 B+ inside, plus RTC, plus RS485 converter, plus Atmel chip).
Currently access the meter using RS485 but atmel chip is also capable of counting the impulses.

Andino Pi is powered by 12V 2A DC power source, everything is on DIN rail ...

I also created a small FCGI script and setup nginx so I'm able to access the meter data and access it using REST.

The setup works quite well and stable.

Post Reply