Author Topic: Finally got around to playing with the Raspberry Pi  (Read 10799 times)

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Finally got around to playing with the Raspberry Pi
« Reply #15 on: December 17, 2013, 07:45:32 AM »
I've semi automated my processor using a Velleman VM110 I/O board and VM132 temperature sensor. All controlled by wifi from an old tablet pc I carry round when its running. Had it running now for over a year. Programmed in VisualBasic.

Hi Bill

Do you implement a control loop for temp vs heater on or is that controlled manually?

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Finally got around to playing with the Raspberry Pi
« Reply #16 on: December 17, 2013, 07:49:45 AM »
You might like to look at this:

http://www.fritz-hut.com/2012/09/04/arduinopiv1.0-includes-api/

He's got an interesting approach exposing the API on the web.  I did ponder doing everything in PHP as I'm used to PHP for web apps.  But what I'm not so sure about is having PHP run full-time as a control loop for a heater, for example - whereas python can quite happily do this.

My natural tendency is to write everything in C or C++, but that's too much like being at work ;)

Offline therecklessengineer

  • Administrator
  • Oil obsessive
  • *****
  • Posts: 648
Re: Finally got around to playing with the Raspberry Pi
« Reply #17 on: December 17, 2013, 12:20:03 PM »
You might like to look at this:

http://www.fritz-hut.com/2012/09/04/arduinopiv1.0-includes-api/

He's got an interesting approach exposing the API on the web.  I did ponder doing everything in PHP as I'm used to PHP for web apps.  But what I'm not so sure about is having PHP run full-time as a control loop for a heater, for example - whereas python can quite happily do this.

My natural tendency is to write everything in C or C++, but that's too much like being at work ;)

Yes, I feel the same way!

You could have the PID loop running on the Arduino (libraries available for that!) and just pass the set point to it from the PI. That would be my approach if I ever get around to it.

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Finally got around to playing with the Raspberry Pi
« Reply #18 on: December 17, 2013, 12:31:35 PM »
You might like to look at this:

http://www.fritz-hut.com/2012/09/04/arduinopiv1.0-includes-api/

He's got an interesting approach exposing the API on the web.  I did ponder doing everything in PHP as I'm used to PHP for web apps.  But what I'm not so sure about is having PHP run full-time as a control loop for a heater, for example - whereas python can quite happily do this.

My natural tendency is to write everything in C or C++, but that's too much like being at work ;)

Yes, I feel the same way!

You could have the PID loop running on the Arduino (libraries available for that!) and just pass the set point to it from the PI. That would be my approach if I ever get around to it.

An embedded micro would indeed be ideal for that kind of thing.

Wouldn't take much of a control loop, really PIDs are overkill for running a resistive heating element .

What I like about python is that tweeking it is very very easy.  I know from work that python scripts can run for extended times (we've has some simulators running weeks) and there are python scrypt mining proxies (EG stratum) that I've used for extended times as well.  So I'm happy enough to do it that way on the Pi, though perhaps with a crontab based watchdog just in case.

So the idea of a python web interface with AJAX style JSON comms to an always-running control script appeals quite a lot.

It could log all actions, something like

12:45 [control] user set temp to 65C
12:45 [action] heater 1 ON
14:11 [control] temp reached target of 65C
14:11 [action] heater 1 OFF
14:15 [control] temp 63C below hysteresis threshold
14:15 [action] heater 1 ON
14:17 [control] temp reached target of 63C
14:17 [action] heater 1 OFF
15:01 [control] user enabled circulation pump 1
15:01 [action] pump 1 ON

What could possibly go wrong? :)
« Last Edit: December 17, 2013, 12:37:21 PM by Tony »

Offline Bill

  • Oil stirrer
  • **
  • Posts: 93
  • Location: Leicester
Re: Finally got around to playing with the Raspberry Pi
« Reply #19 on: December 17, 2013, 03:26:39 PM »
Temperature control is within the VB program, just a simple on/off between temperature limits 1.5 deg either side of the target temperature. More than adequate for my needs, no need for a PID routine.
Before I started the remote control stuff I had a PID controller which is now set to some degrees above the processing target temperatures so it doesn't interfere. I can still go back to manual running if the automation fails.
Still forever scrabbling up the learning curve.
Seat Altea 2004 & Fiat Scudo 2004 both 100%BD
Both sold
Skoda fabia 2012 on B50 since 2017

Offline therecklessengineer

  • Administrator
  • Oil obsessive
  • *****
  • Posts: 648
Re: Finally got around to playing with the Raspberry Pi
« Reply #20 on: December 17, 2013, 04:27:02 PM »
It could log all actions, something like

It could also ping you an email when it's up to temperature.  ;D

I don't like the burst fire method of PID regulation. It upsets Lizzie with the load coming on and off. My hypothetical automation system would check the load before allowing heat.

You'd be interested in the marine automation systems. Far too complex to go into here though. Perhaps at the next BBB.

Your system sounds cool Bill. If I ever get mine running, I'd do the same and use an old tablet as an interface. Perhaps even with another screen mounted somewhere so I can monitor while watching the box.

It did occur to me that a car central locking motor would be ideal for actuating a ball valve...

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Finally got around to playing with the Raspberry Pi
« Reply #21 on: December 17, 2013, 04:37:06 PM »
It could log all actions, something like

It could also ping you an email when it's up to temperature.  ;D

I don't like the burst fire method of PID regulation. It upsets Lizzie with the load coming on and off. My hypothetical automation system would check the load before allowing heat.

You'd be interested in the marine automation systems. Far too complex to go into here though. Perhaps at the next BBB.

Your system sounds cool Bill. If I ever get mine running, I'd do the same and use an old tablet as an interface. Perhaps even with another screen mounted somewhere so I can monitor while watching the box.

It did occur to me that a car central locking motor would be ideal for actuating a ball valve...

I've been contemplating how to do this too.  Wiper motors are probably pretty good for this kind of thing too, though perhaps a bit too powerful (find one on a mini?)  Or a stepper motor on a gate valve?

Then you're into the land of vacuum sensing the venturi port and checking pump head pressure to make sure the valves operated correctly...  All doable :)
« Last Edit: December 17, 2013, 04:40:17 PM by Tony »

Offline julianf

  • Wiki Editor
  • Grand Gunge Master
  • ******
  • Posts: 1388
  • Location: Devon
Re: Finally got around to playing with the Raspberry Pi
« Reply #22 on: December 17, 2013, 04:50:52 PM »
Central heating valves are commonly electrically operated.  I dont know what the bore is like on them though (full bore?).

Theyre not that cheap, but way simpler than hooking up motors to lever valves.



Are you working in Python for this?  I dont know much about the pi, but im aware other languages are possible also.


For custom cnc cut instrument panels, see - http://www.thebeast.co.uk

Collections website - http://www.devon-used-cooking-oil-collection.co.uk

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Finally got around to playing with the Raspberry Pi
« Reply #23 on: December 17, 2013, 05:07:16 PM »
Central heating valves are commonly electrically operated.  I dont know what the bore is like on them though (full bore?).

Theyre not that cheap, but way simpler than hooking up motors to lever valves.

Are you working in Python for this?  I dont know much about the pi, but im aware other languages are possible also.

CH valves aren't full bore and I think they might have an o-ring seal in the changeover part (I'll take a look tonight, I think I kept the one that failed on my boiler circuit).

Yes Python just because I fancy doing it in Python.  Ruby, PHP, C... it's all possible.  I'm a C coder by trade but Python makes for much quicker bringup and no need for cross compiling (native C compiling on the Pi is a little tedious).

Offline Bill

  • Oil stirrer
  • **
  • Posts: 93
  • Location: Leicester
Re: Finally got around to playing with the Raspberry Pi
« Reply #24 on: December 17, 2013, 07:46:41 PM »
I used a 3/8"BSP 12v solenoid valve on the drain, it has viton seals. Works OK but flow rate is low, not a problem in a 50 lt processor. The lower flow rate on a drain valve probably makes it a little more controllable. Bigger valves are available, they start to get expensive but they are easy to open and close.
Got it from solenoidvalvesuk.com
Still forever scrabbling up the learning curve.
Seat Altea 2004 & Fiat Scudo 2004 both 100%BD
Both sold
Skoda fabia 2012 on B50 since 2017

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Finally got around to playing with the Raspberry Pi
« Reply #25 on: December 17, 2013, 07:53:29 PM »
Was it expensive?  For a drain valve slow is good.  Do you have an opto-sensor and light to watch for the phase change?

I've got some washing machine valves but I think they would melt.  And 1" ones for the pipework probably get very expensive.

Offline Bill

  • Oil stirrer
  • **
  • Posts: 93
  • Location: Leicester
Re: Finally got around to playing with the Raspberry Pi
« Reply #26 on: December 18, 2013, 07:49:10 AM »
The valve was about £65. I use honeywell optical level sensor (very expensive but very good at what they do) to monitor liquid level. I don't drain to completion (the phase change) just to a preset level or to a preset level then an additional time increment, depends on process stage. Detection of liquid level is easier than trying to detect a phase change. Batch sizes have to be pretty constant batch to batch.
To me it doesn't matter if there is a bit of glyc left behind or wash water, it won't screw up the next process step. Hence no need to detect a phase change ie glyc to bio or wash water to bio. I have a manual override button for the drain valve if needed to drain some more between stages.
Still forever scrabbling up the learning curve.
Seat Altea 2004 & Fiat Scudo 2004 both 100%BD
Both sold
Skoda fabia 2012 on B50 since 2017

Offline therecklessengineer

  • Administrator
  • Oil obsessive
  • *****
  • Posts: 648
Re: Finally got around to playing with the Raspberry Pi
« Reply #27 on: December 18, 2013, 12:30:06 PM »
Perhaps we should have a section of the forum for DIY industrial automation projects?  8)

Offline Julian

  • Administrator
  • Oil baron
  • *******
  • Posts: 6389
    • Used Cooking Oil Collection website
  • Location: East Surrey, UK.
Re: Finally got around to playing with the Raspberry Pi
« Reply #28 on: December 19, 2013, 10:44:04 AM »
A windscreen wiper motor should have enough torque to drive a standard ball valve.

I assume they can be reversed, if so you just need a couple of limit switches and a bracket.
Used Cooking Oil Collection website ... http://www.surreyusedcookingoilcollection.palmergroup.co.uk

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Finally got around to playing with the Raspberry Pi
« Reply #29 on: December 19, 2013, 11:38:35 AM »
Perhaps we should have a section of the forum for DIY industrial automation projects?  8)

Great idea.  Done - lets see how it goes and whether it gets any use (otherwise we'll just merge it back).