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

0 Members and 1 Guest are viewing this topic.

Offline BorisKontorovich

  • Contributor
  • Posts: 7
  • Country: us
    • Raspberrypi Gym
Controlling 8 solenoid air valves.
« on: April 19, 2018, 05:42:30 am »
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 19, 2018, 05:44:07 am by BorisKontorovich »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4905
  • Country: us
Re: Controlling 8 solenoid air valves.
« Reply #1 on: April 19, 2018, 06:33:18 am »
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 BorisKontorovich

  • Contributor
  • Posts: 7
  • Country: us
    • Raspberrypi Gym
Re: Controlling 8 solenoid air valves.
« Reply #2 on: April 21, 2018, 11: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.
 

Online mikerj

  • Super Contributor
  • ***
  • Posts: 1686
  • Country: gb
Re: Controlling 8 solenoid air valves.
« Reply #3 on: April 22, 2018, 04:50:24 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.

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: 1145
  • Country: ca
Re: Controlling 8 solenoid air valves.
« Reply #4 on: April 22, 2018, 06:08:24 am »
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: 6435
  • Country: us
Re: Controlling 8 solenoid air valves.
« Reply #5 on: April 22, 2018, 02:40:19 pm »
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 BorisKontorovich

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

Thanks everyone for the info.

B.
 

Online mikerj

  • Super Contributor
  • ***
  • Posts: 1686
  • Country: gb
Re: Controlling 8 solenoid air valves.
« Reply #7 on: April 25, 2018, 06:33:39 pm »
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

  • Frequent Contributor
  • **
  • Posts: 752
  • Country: nz
  • Currently at SiFive, previously Samsung R&D
Re: Controlling 8 solenoid air valves.
« Reply #8 on: April 30, 2018, 05:41:55 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.

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 24, 2018, 06:22:09 am »
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