0

I thought I was too old to appreciate the power of the Pi so pushing 60 I decided to educate myself :-(. What I need to do is to run a micropump (6V DC) on demand for as long as needed depending on a numeric real positive input. If for example, the input is 50 I multiply it by a constant = 0.1269 gives 6.349 in seconds so I would like to turn on the pump via the relay for 6349ms, I do not have a clue ( I just ordered my pi) of what else I need hardware wise or software.

Any help is much appreciated in advance

  • What language are you using to program the Pi? – Brick Jul 24 '17 at 21:21
  • I understand Python is the preferred language here, I have not done any programming since college, days of Pascal and Fortran7 :-( got to get busy with Python. – silas Jul 27 '17 at 19:34
  • I advise against Python if you've got a background in something else. Don't let the Flying Circus draw you in just because it's loud. On the other hand, I'm not sure that Pascal or Fortran77 are going to get you very far. Maybe C/C++? – Brick Jul 27 '17 at 19:36
  • What would be the advantage of using C, | ++ or # ? Can't what I need to do be done with Python? This is sort of time sensitive and need to find the fastest path to delivery. – silas Jul 30 '17 at 15:52
  • If you're learning a new language anyway, C or C++ would potentially be closer to what you already know (Pascal and Fortran). If you want Python, it should also work for what you've proposed. My personal experience with Python on the Pi is that it's fine if you can find open source that matches the hardware that you want to use. If you cannot find that, sometimes you have to write C anyway because Python (as far as I know) does not provide any direct access to the hardware. Where you find open source, they've basically wrapped C in Python for you. They don't have some special Python trick. – Brick Jul 30 '17 at 16:04
1

The 'easy' (read, expensive) way to do this is to get a 'relay hat' or an 'i/o hat' = a little PCB that contains at least one relay and plugs on top of the Pi (hence 'hat) and picks up some of the i/o pins.

I woud say the most easy way to program the Pi is to use the 'Python' language - this will allow you to type in the delay you want, do the calculation and then 'activate' the relay ..

Most i/o hats will also support INPUTS .. so for example, if you have (say) a fluid level 'switch' sensor, the opening and closing of the sensor contacts could be 'detected' by your Python code.

I recommend you Google for 'Raspberry Pi fish tank control project' (or similar) :-)

  • Well, there are single relay boards out there (20 $) but seem to be made for Arduino, I have not found one for the Pi and I am not sure if it would "fit". Very interesting that bit about them I/O hats supporting inputs it could make mt life a lot easier. Thank you very much for your insight sir, on my way to google fish tank project. :-) – silas Jul 27 '17 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.