User avatar
ScottBouch
Posts: 146
Joined: Wed Jun 06, 2012 12:32 pm
Location: Midlands, UK
Contact: Website

Re: GPIO Data Logger

Fri Nov 09, 2012 2:18 am

I've finished my interface board! A few late nights got it done...

Tomorrow I'll start hooking it up to the boiler to fo some REAL LIVE MAINS Raspberry Pi Datalogging!
rps20121109_014041.jpg
rps20121109_014041.jpg (47.32 KiB) Viewed 3455 times
rps20121109_021138.jpg
rps20121109_021138.jpg (42.97 KiB) Viewed 3454 times
The Veroboard and resistors are 30+ years old, and the box is a case that a memory stick came in!

I can't thank JOAN enough for his work on this project... He's saved me a fortune in plumbers fees!


Cheers, Scott
http://www.scottbouch.com

http://www.youtube.com/user/sbscottmonkey - - - YouTube Channel

mmaes
Posts: 17
Joined: Wed Nov 07, 2012 8:28 pm

Re: GPIO Data Logger

Fri Nov 09, 2012 9:57 am

I had a quick play at using interrupts but was not successful (unless you think locking the machine up is a success :D ).
I probably did something wrong.
Seems like you certainly interrupted something... ;)

I've been browsing the CPU-manual briefly yesterday and came to the same conclusion regarding the number of interrupts available. I've also found some helpful text on general embedded interrupt programming, that also covers the problem of new interrupts being generated while the code is still dealing with the first one. It's going to be interesting...
Marc

mmaes
Posts: 17
Joined: Wed Nov 07, 2012 8:28 pm

Re: GPIO Data Logger

Fri Nov 09, 2012 10:01 am

@rgh
You say you don't have an oscilloscope, but you have a RaspberryPi... just search for Panalyzer on these forums.
I've ordered the RaspberryPi yesterday! It should arrive in about 4 weeks. Thanks for the link to Panalyzer, I will look into it.

Marc

mmaes
Posts: 17
Joined: Wed Nov 07, 2012 8:28 pm

Re: GPIO Data Logger

Fri Nov 09, 2012 10:03 am

@Scott: looks very good!

User avatar
ScottBouch
Posts: 146
Joined: Wed Jun 06, 2012 12:32 pm
Location: Midlands, UK
Contact: Website

Re: GPIO Data Logger

Fri Nov 09, 2012 10:19 am

I'd not heard of Panalyzer, i'll have a look, sounds interesting!

MMAES, cheers! I've taken the covers off my boiler this morning before going to work, hopefully will have it rigged up over the weekend!

Cheers, Scott
http://www.scottbouch.com

http://www.youtube.com/user/sbscottmonkey - - - YouTube Channel

User avatar
ScottBouch
Posts: 146
Joined: Wed Jun 06, 2012 12:32 pm
Location: Midlands, UK
Contact: Website

Re: GPIO Data Logger

Mon Nov 12, 2012 6:45 pm

FIXED IT! :D

The datalogger worked very well, and pointed me in the direction of the airflow switch..

A small venturi exists in the flu, a small pipe joins the centre of the venturi to a small diagram pressure switch, so as to make the switch when the pipe pressure drops below atmospheric.

This pipe has a tiny calibrated leak installed in it... A tiny brass bush pushed into a tiny hole in the pipe wall... This brass bush has a really tiny hole drilled through the middle, and it was full of dust!

This calibrated leak didn't even exist in the manual... A proper needle in a haystack that I'm thankful to Joan and the Raspberry Pi for helping me find!

We now have a warm house, and hot showers!
rps20121112_183516.jpg
rps20121112_183516.jpg (42.7 KiB) Viewed 3364 times
rps20121112_183445.jpg
rps20121112_183445.jpg (44.73 KiB) Viewed 3364 times
http://www.scottbouch.com

http://www.youtube.com/user/sbscottmonkey - - - YouTube Channel

User avatar
joan
Posts: 14006
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Data Logger

Mon Nov 12, 2012 6:55 pm

Well done!

But you'll now have to find another excuse to ignore the wife. :D

User avatar
ScottBouch
Posts: 146
Joined: Wed Jun 06, 2012 12:32 pm
Location: Midlands, UK
Contact: Website

Re: GPIO Data Logger

Mon Nov 12, 2012 8:19 pm

joan wrote:But you'll now have to find another excuse to ignore the wife. :D
That would go down like a lead balloon!

Thanks again for all your help on this, I really feel like I've learnt a lot about Linux, C, and the Pi's GPIO through this exercise! Oh , and my boiler!

Doing something like this has helped to build my confidence with the command line interface, got to keep on practising! :geek:

Thank you again for the help and guidance provided throughout! :D

Now I'll see if I can advise @mmaes with his interesting power usage circuit... It will be nice to give something back to the community, a Person A helps Person B, who helps Person C type thing...

Cheers, Scott
http://www.scottbouch.com

http://www.youtube.com/user/sbscottmonkey - - - YouTube Channel

User avatar
ScottBouch
Posts: 146
Joined: Wed Jun 06, 2012 12:32 pm
Location: Midlands, UK
Contact: Website

Re: GPIO Data Logger

Mon Nov 12, 2012 11:24 pm

To be fair, she did admit to being quietly impressed, but wouldn't make a song and dance out of it as it would go to my head!

She was half expecting it not to work, my hours of soldering to be wasted, and us to have to buy a new boiler.. so I'm very pleased as it's saved us about £1000!

Ceers, Scott
http://www.scottbouch.com

http://www.youtube.com/user/sbscottmonkey - - - YouTube Channel

mmaes
Posts: 17
Joined: Wed Nov 07, 2012 8:28 pm

Re: GPIO Data Logger

Tue Nov 27, 2012 12:26 pm

Hi Scott / Joan,

I've been doing quite some research on my upcoming S0-project recently. To keep all info at together (and get my ideas down), I've put some things down on my own website (http://www.mmaes.com/index.php/en/raspiprojecten).

Maybe you could have a first look on it and help me out with a couple of the questions?

Regards,
Marc

User avatar
ScottBouch
Posts: 146
Joined: Wed Jun 06, 2012 12:32 pm
Location: Midlands, UK
Contact: Website

Re: GPIO Data Logger

Sat Dec 08, 2012 12:16 pm

mmaes wrote:Hi Scott / Joan,

I've been doing quite some research on my upcoming S0-project recently. To keep all info at together (and get my ideas down), I've put some things down on my own website (http://www.mmaes.com/index.php/en/raspiprojecten).

Maybe you could have a first look on it and help me out with a couple of the questions?

Regards,
Marc
Hi Marc, I can't access your website with that link...

Cheers, Scott
http://www.scottbouch.com

http://www.youtube.com/user/sbscottmonkey - - - YouTube Channel

mmaes
Posts: 17
Joined: Wed Nov 07, 2012 8:28 pm

Re: GPIO Data Logger

Sun Dec 09, 2012 3:01 pm

Hi Scott, I fixed the link.

Greetz, Marc

jdjoey
Posts: 4
Joined: Tue Feb 04, 2014 12:27 pm

Re: GPIO Data Logger

Fri Feb 07, 2014 7:07 am

Hi,

I've followed your conversation and have tried to run your script on my rasp to meassure a pulse from an s0 bus.

For so far it works. Now it's the trick to count them and export an value...
if i get 2000 pulses it has a value of 1... is there an way to count them ?
i'm not that familiar with C.

User avatar
joan
Posts: 14006
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Data Logger

Fri Feb 07, 2014 9:41 am

jdjoey wrote:Hi,

I've followed your conversation and have tried to run your script on my rasp to meassure a pulse from an s0 bus.

For so far it works. Now it's the trick to count them and export an value...
if i get 2000 pulses it has a value of 1... is there an way to count them ?
i'm not that familiar with C.
There are several ways.

If you save the output to a log file which I'll imaginatively assume is called log file you could use

grep -c " 1" log_file

Which works as all the 1 values have a space before (gives 7 for your snippet).

For more flexibility have a look at pigpio.

For instance in pigpio Python you could get a count as follows. N.B. the forum seems to add a spurious 4 spaces at the start of each line if you use select all. You'll have to delete them. Alternatively do a manual cut & paste.

Code: Select all

#!/usr/bin/env python

import time

import pigpio

GPIO=4

pigpio.start()

pigpio.set_mode(GPIO, pigpio.INPUT)

cb = pigpio.callback(GPIO, pigpio.RISING_EDGE)

tally_1 = cb.tally()

time.sleep(50)

tally_2 = cb.tally()

print("counted {} rising edges".format(tally_2-tally_1))

cb.cancel()

pigpio.stop()
You have to make the script executable. If it's called tally.py do
chmod +x tally.py

To run it make sure the pigpio daemon is running with

sudo pigpiod

then

./tally.py

There is a cheat to test the code without having your kit connected.

Have two windows. In one start tally.py. In the other enter the commands

pigs w 4 0;pigs pfs 4 0; pigs p 4 128

This will change the gpio back to an output, set the minimum PWM frequency of 10Hz, and output equal dutycycle pulses to the gpio.

In all the above I have assumed you are using Braodcom gpio 4.

jdjoey
Posts: 4
Joined: Tue Feb 04, 2014 12:27 pm

Re: GPIO Data Logger

Mon Sep 15, 2014 7:48 am

Hi there im back in bussines.
Had wat problems with my healty.
But i had to say Thanx for the reply. ;)

mmaes
Posts: 17
Joined: Wed Nov 07, 2012 8:28 pm

Re: GPIO Data Logger

Fri Nov 28, 2014 1:18 am

Hi Scott / Joan,
It has been quite a while that I posted on this thread.
I've picked up on an old subject of mine, the 12x S0 logger. This time, after many replies on this forum, I decided to use a different approach. I am still using the MCP 23017 as GPIO, but I've paired it with a Microchip PIC18F26K22. Also, I've added an ethernet module to the design.
I am interested if any of you would be interested in reviewing the schematics and the design?
It seems I am unable to upload them to the board. I have posted them on my own site.
http://mmaes.com/electronics/new-design ... -s0-meter/

As for the general idea of the logger, the situation is that whe have a mains fuse box with 12 groups. Each group is (or will be) fitted with a kWh-meter that has a S0-pulse (1pulse per Wh). I am interested in an insight of the usage per group per timeframe. That is, not the cumulative usage (the meters would show that), but the usage at times of the day. The idea is that the logger should timestamp each pulse per group. for that reason I've included the RTC DS1307.
The logger should periodically communicate with a PC/NAS/Raspi running Linux, to log the data. The device itself should be able to log for about 2-4 days without communications.

Interested to hear from you!
regards,
Marc

smitti
Posts: 1
Joined: Mon Jun 01, 2015 6:11 pm

Re: GPIO Data Logger

Mon Jun 01, 2015 6:15 pm

HI there,

I am new to this forum and to the raspberry pi.
I like this forum post just because it goes about wy I bought the PI

going to try to make it work :)

Greets, Peter

Return to “Automation, sensing and robotics”