Help Controlling Analog Electromagnetic Actuators

I am building a device that utilizes small electromagnetic actuators. The device also has a video feed component to monitor the actuator action. I’ve begun experimenting with Blynk as the GUI for this device and am comparing the virtues and liabilities of the Raspberry pi vs Arduino hardware platforms. Ideally I need 4 PWM individual controls (Blkynk’s sliders would be great for this initially). Since the Raspberry has a single PWM GUIO port I would like to know if there another method by which one can create a virtual PWM port or otherwise control an analog actuator (these actuators need to move incrementally and settle at specified locations momentarily before moving on). My programming skills are childlike (and that may be a disservice to the child) but I can understand code concepts and cut and paste and write elementary code. Rather than shotgunning through all the available tutorials and demonstrations I would like to know if there is a person or an online resource that might more directly address my needs for this device. As far as the video feed is concerned, I currently have that configured as a separate system altogether but would love to integrate it though the Raspberry if that is possible. Thanks for any pointers anyone can provide!

What you could do is address the actuators through an Arduino. I think they are more robust for this kind of application seeing as it is a microcontroller.

You could run a local Blynk server on the Pi. Both the Arduino and the App would connect to there. This gives the lowest possible latency and should be fairly easy to accomplish, assuming you don’t run some stupid Media thing on the Pi like OpenElec, but a ful-fledged OS like Raspbian.

You’d also adres the PWM issue because the Nano or Uno have enough PWM pins to suit your needs. They are more stable than a Pi (which is basically a small computer) and a lot cheaper :slight_smile:

Thanks for the insight. I did a lot of development using an arduino (Duemilanove) and the PWM, as you said, worked great. I was seduced by the video and networking capabilities built into the Raspberry Pi (hoping I could find a solution to all the I/O in a single piece of hardware). I’ll ponder your advice and probably switch back - which Arduino would you recommend as the most robust? On another note, can you explain to me what a slider (blynk) is doing when addressing an analog pin - for example, would that be one way to control the speed of an autonomously powered (or board powered) DC motor?

New Note: My goal (based on correspondence above) is to use Blynk tools to communicate with the Raspberry pi to control the PWM output from the attached Arduino (and return signals from a humidity sensor attached to the arduino via pi to the Blynk GUI). I am stymied here: How do I create a slider in Blyunk that generates a continuous range of outputs from a pi pin (real/virtual?) that are input via an arduino pin (where?) and result in a corresponding range of PWM output signals? I believe that once I understand the pin I/O and connectivity parameters I can generate the arduino code to move the I/O data appropriately. Thanks!

An analog pin on the Arduino can be controlled via Blynk the same way as you do in the sketches. If you set the slider to 512 for example, the output will be 512 (or 2,5v in terms of power).

Networking can be built into the Arduino as well of course, but this is quit rudimentary. You can hook up the Pi to Blynk as well and let it connect to a Blynk server. If you have the Arduino('s) connect to the same cloud server you can manage the Arduino’s or the Pi via a Bridge Widget. With this Widget you can send controls from one device to another.

For instance, I have an Arduino Mega hookup up to a couple light sensors and when it’s dark they remotely turn on a LED in the hall, which is basically a LED strip connected to a ESP-01 wifi board which also connects to the Blynk cloud (in my case a local server on a Pi, but this could be anything since the Java software will run on basically anything that support Java). So you could remote control Arduino’s through your Pi with this setup.

I think this will put you on the right path. at least I hope. :slight_smile:

Thanks a lot! I am making progress, I think : ) Running the arduino via a USB connection to the Pi worked fine except when I tried to use a GPIO from the Pi hardwired to an input pin on the arduino to modulate the PWM output - that is why I asked about the Blynk sliders (and thanks for the lucid explanation!). Right now I am writing a sketch to coordinate three dimensions of the EM actuators I am using just to learn how the code works on the arduino side. Once I get that done I will start in on learning how to build the Blynk front end to allow a user to input variable or patterns that will be translated into motions of the actuators - if I get that far I will celebrate with a nice whiskey!

1 Like

I definitely don’t know if hardwiring a pin from the Pi to the Arduino is a good idea, but I celebrate your creativity :smiley:

Maybe you can try to wire it to a Analog port or a Digital port, but I don’t know what will happen or even if the applied voltage is the same.

That whisky sounds like an idea though, merry x-mas too :wink:

Ha ha - thanks - I celebrated after only partial success - the pattern writing on the arduino side is going well - the whiskey was smooth - and today despite the former I was able to solder some tiny connectors to flex cable that should have evaporated, so all in all things are moving right along. I am sure I will be stymied once again trying to get blynk to work with the arduino IO - but the answer is out there, somewhere!

1 Like