I am pleased you have your scopes up and running
, what are you making with a Raspberry pie and touch screen ?
Hi Rob,
I'm using the Raspberry Pi for our Hydro Scheme.
You may regret asking me what I'm doing with it but here goes:
We currently have two grease pumps which supply biodegradeable grease to the bottom bearings of the Archimedes screws. Each top bearing has two Simalube grease cartdridges. These have a dry cell which generates hydrogen to pressurise the cartridge thus forcing the grease out into the bearing. These cartridges are expensive and cost around £250/year all to dispense around £5 worth of grease. I've ordered an SSVD which is a valve which will send a certain proportion of the grease pump output to each of the 6 grease points. I need 10gm of grease/day to each of the two bottom (submerged) bearings and 1gm/day to each of the ports on the top bearings. The SSVD has an indicator pin which moves in and out as grease moves through it. I'm detecting this movement with a proximity sensor. This connects to the Pi through an opto-isolator to keep 24v well away from the inputs of the Pi.
The grease pump will be set to run for approx 20 seconds every 40 minutes. When the Pi sees the pin move it will start timing. If it doesn't see the pin again within say 41 minutes it will sound an alarm in our power house and, more importantly as the power house is normally unmanned, send an email telling a few of us that the grease pump may be empty or may be faulty. This was my first venture into the world of Python programming.
Flushed with the success of this I set about trying to measure screw speed.
The system records screw speed but only once every 15 minutes. We think we've had some violent overspeeds but these have been missed by the log file. 6 tons of not well balanced screw spinning fast could have disastrous consequences. The screws normally run very slowly (max of about 30 rpm, min about 6 rpm) so I thought the Pi would have no problems looking at a proximity sensor which is set to detect big socket screw heads on a coupling between the screw and the gearbox. There are 12 bolts on the coupling so the max frequency I'd be looking at would be 6Hz. Not rocket speeds. I decide that the best way to get the speed would be just to get the time between the sensor seeing two bolt heads.
I soon found that, even at the pedestrian speeds I was looking at, the Pi is useless at real time stuff when using a multitasking operating system unless you use interrupts. This is where it got scary for me.
For GPIO control I was using pigpio which had a function something like wait_for_edge.fallingedge with timeout which I thought would work nicely and the timeout function would cope with a screw being stopped. The results I got were fairly promising but every now and then a spurious result. This is when I got the scopes out to look at the output from my pulse generator (which I was using to simulate the output I'd get from a running screw) as I thought it may be inconsistent - it wasn't.
I contacted the author of pigpio and emailed him my code. He very quickly replied telling me that the times returned by his wait_for_edge function could be up to 0.1sec out! He would change his documentation to make this clear. He suggested using callbacks (from interrupts) and within a couple of hours had emailed me some basic working code.
I then set about filtering the results to only show > 1% changes in speed and writing the results to a log file with a timestamp. Without the filter the files would grow to enormous proportions. I'm just getting the code right for starting a new log file at 00:00:00 every day and emailing myself the previous day's file.
The touch screen is so I can have a live screw speed display in the power house. Then I might think about drawing speed/time graphs.
You did ask!

Have a Very Good Christmas and a Happy & Healthy 2016.

Phil.