Author Topic: Controlling 8 solenoid air valves.  (Read 2617 times)

0 Members and 1 Guest are viewing this topic.

Offline BorisKontorovichTopic starter

  • Newbie
  • Posts: 7
  • Country: us
    • Raspberrypi Gym
Controlling 8 solenoid air valves.
« on: April 18, 2018, 07:42:30 pm »
Hello Everyone

I need to build a controller to open and close 8 solenoid air valves at precisely timed intervals.  Open and closed time does not change during operation, but each line has different timing independent from all other lines.  I have a circuit to drive solenoids figured out, but I am looking for a good general approach to how I would control the system.  The time it takes the solenoid valve to open is 100 milliseconds, so I would not have on or off periods shorter than 200 milliseconds. 

Let me know if I provided enough info to give an answer or if more detail is needed.

Thank you!!!
« Last Edit: April 18, 2018, 07:44:07 pm by BorisKontorovich »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Controlling 8 solenoid air valves.
« Reply #1 on: April 18, 2018, 08:33:18 pm »
I would just use an Arduino to drive your solenoid drivers.  You didn't describe the solenoid driver so there's nothing I can say about interfacing between the Arduino and driver but it shouldn't be hard.

You can then program the Arduino to cycle the valves in any sequence you wish.

You didn't give a range of on-off times.  Are we talking a complete cycle takes a few seconds or a few days?  Either way, the Arduino is probably the easiest way to get it done.

There are alternative solutions with 555 timers but it depends on how the sequence actually works as to whether a discrete approach is workable or not.
 

Offline BorisKontorovichTopic starter

  • Newbie
  • Posts: 7
  • Country: us
    • Raspberrypi Gym
Re: Controlling 8 solenoid air valves.
« Reply #2 on: April 21, 2018, 01:55:32 pm »
Thank you for reply.

My concern with running it on Arduino is for very short pulses 200 ms I would have to run some amount of code checking timing - I am concerned that for such a short period of time, I wont be able to finish all the calculations in time.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3238
  • Country: gb
Re: Controlling 8 solenoid air valves.
« Reply #3 on: April 21, 2018, 06:50:24 pm »
Thank you for reply.

My concern with running it on Arduino is for very short pulses 200 ms I would have to run some amount of code checking timing - I am concerned that for such a short period of time, I wont be able to finish all the calculations in time.

If the open/closed times don't change then there's very little for the Arduino to do.  If there are any heavy calculations needed to calculate the times, they could be completed before you start the timer running. 

I suspect you could quite easily handle everything from a single timer interrupt and still keep jitter in the low microseconds range.
 

Online NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: Controlling 8 solenoid air valves.
« Reply #4 on: April 21, 2018, 08:08:24 pm »
My concern with running it on Arduino is for very short pulses 200 ms I would have to run some amount of code checking timing - I am concerned that for such a short period of time, I wont be able to finish all the calculations in time.

200 ms is very slow. You can use practically any MCU. Unless your calculations are very complex.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Controlling 8 solenoid air valves.
« Reply #5 on: April 22, 2018, 04:40:19 am »
Yeah 200mS is an eternity to a microcontroller.  That was something that took some getting used to when I first started working with microcontrollers, just how blindingly fast they are. Think about it this way, even running at a very slow clock speed of 1MHz most microcontrollers will be running something around 100,000 C instructions during each of those 200mS, surely whatever calculations you're doing are not going to require anywhere near 100,000 instructions. 1MHz is very slow, the bog standard Arduino runs at 16MHz, that's millions of instructions per second. 
 

Offline BorisKontorovichTopic starter

  • Newbie
  • Posts: 7
  • Country: us
    • Raspberrypi Gym
Re: Controlling 8 solenoid air valves.
« Reply #6 on: April 25, 2018, 01:21:54 am »
Ok, I will give it a try.

Thanks everyone for the info.

B.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3238
  • Country: gb
Re: Controlling 8 solenoid air valves.
« Reply #7 on: April 25, 2018, 08:33:39 am »
Ok, I will give it a try.

Thanks everyone for the info.

B.

Just make sure you learn about and use hardware timers. Don't fall into the common beginners trap of using software delays for everything.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: Controlling 8 solenoid air valves.
« Reply #8 on: April 30, 2018, 07:41:55 am »
Thank you for reply.

My concern with running it on Arduino is for very short pulses 200 ms I would have to run some amount of code checking timing - I am concerned that for such a short period of time, I wont be able to finish all the calculations in time.

What kind of calculations?

Even a standard Arduino Uno with 16 MHz CPU can do about 20000 floating point operations in 200 ms. That's with software FP emulation as they don't have hardware FP. If you can use integer or fixed point then you can do millions of adds or subtracts per second, even in 16 or 32 bit. Or millions of 8x8 -> 16 multiplies too.

They're plenty fast enough to make self-balancing machines, run a bunch of stepper motors on 3D printers, or even control autonomous model aircraft.
 

Offline sorsor

  • Newbie
  • Posts: 1
  • Country: us
Re: Controlling 8 solenoid air valves.
« Reply #9 on: May 23, 2018, 08:22:09 pm »
I did similar thing and I used the following approach.

I registered the start_time for each solenoid when I received a command to turn the solenoid on. I had an on_flag vector saying if the solenoid is on or off.
Then, I check if anything needs to be turned off (start_time[1:8] - current_time > desired_pulse[1:8]). I used millis() to get the current time. Pay attention to overflows, though. This worked very well on an Arduino.

Hope this helps.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf