4

I'm not sure if this is the best place to ask but I will give it a try. I build mechanisms that are used in commercials, tv shows, window displays, multimedia art etc. They generally involve electronic control over relays, solenoids, stepper motors, dc motors, etc. There are usually less than 10 outputs but it varies. Sometimes there is a need for inputs such as a limit switch.

I typically just program an arduino for the specific application. This works fine but I want a setup that can be quickly reused for different applications and which can offer other features. I like the idea of using some type of visual programming language like node red or max/msp. This would make it easier for me (not a great programmer and not always in a position to dig up the most recent arduino sketch) to make changes on the fly. I also like the ability to create guis/dashboards like the ones in node red which will allow clients to log in and be able to adjust things themselves, it seems very easy and looks professional.

I want to know if there are any options that people here can suggest, here is what I am considering:

  • raspberry pi with node-red controlling an arduino running firmata
  • raspberry pi with node-red using gpio to control things directly
  • pc running live/maxmsp controlling arduino using maxuino
  • some kind of PLC/smart relay?
  • touch designer? touchOSC or something else I'm not thinking of?

Any suggestions would be appreciated

Update: Thanks for the suggestions. I am leaning towards something like that although wired since the components are close together. I am just not sure of the most efficient way to control steppers with node red. I am working on two setups for a commercial right now and I am trying two different systems. One is a bank of solenoids controlling pneumatics in a sequence. The other is mostly stepper motors and a couple of relays. For the pneumatics which is mostly simple on/off of relays/solenoids, I am using node-red on a pi going into an arduino mega running firmata. For the shot that is mostly steppers, I am using a velocio.net plc which controls steppers natively. I would kind of prefer to use node-red for the steppers but the velocio seems easier, I would love you be proven otherwise. I would like as much of the control of the stepper speed/position to be in node red as possible yet not have it be to complicated of a flow. Any ideas?

1
  • is there a size limitation for the devices, such as a motor or solenoid? ..... perhaps you could make the system modular with a separation between power supply and control .... the motors, solenoids, LEDs, etc. could each be configured into its own module, similar to hobby servo motors .... each module would have power connections and control connections .... the controller would not have to be "concerned" with the power requirements of any of the hardware devices ..... motor control could be as simple as left/right or direction/on .... or as complicated as speed control with ramp up/down
    – jsotola
    Feb 2, 2019 at 0:51

2 Answers 2

1

I would make many wifi modules. Then you can use a variety of higher-level tools like node-red to quickly sequence complex actions and reactions.

Wire an ESP8266 to all the things, and give each a generic low-level rest API in the firmware. For a relay module, this might support three endpoints: /on, /off, and /toggle. A temp sensor could have one like /read/f. Anyway, writing such firmware to do the most basic functions is trivial.

Some might need to push actions out, which requires holding a server url in the firmware of each device. For example, a button firmware might have a "reportingURL" config field, and when pressed, the buttong sends an HTTP/WS/MQTT packet to the server with a message like ping(reportingURL + "?id=btn"+String(myDevID)+"&state=pressed").

Anyway, once you have everything wired to the network, using node-red or whatever is pretty simple; you just drag and connect the actions and reactions as needed. You do all the heavy lifting in a nice powerful GUI instead of in C++. Simpler, very little firmware upgrading needed once operational, and very flexible.

Want to change a motor to stop when a button is double-clicked instead of single-clicked? just edit node-red and re-deploy, no flashing, no difficult debugging, and no custom-per-project C++ code needed.

1

If I were you I'll do the following :

  • Pick a master that will be in charge of asking for information to the other
  • Pick a slave you're familiar with, they will be in charge of responding the master
  • Choose the communication protocol you are familiar with
  • Enumerate all the modules you can be using

Now the more flexibility you will want the more complexity your code will get. If I had to do that I would probably go with ESPs and a raspberry pi as master.

  • I would code some kind of driver for any possible module you will be using with the ESPs (ADC/DAC/motors) whatever.

The master will need to have a description of every slave it has for instance, it will need to know were it can read, were it can write and what.

You can also improve this solution with a big firmware for the slave where the master will also be able to describe to the slave what the slave has connected. For instance the master will use a function such as :

  • declare_slave_ADC( slave0 , I2C_Addr);
  • declare_slave_motor(slave0 , GPIO0 , GPIO1);
  • read_slave_ADC(slave0, I2C_Addr);
  • set_slave_motor_speed(slave0, GPIO0 , GPIO1);
  • set_slave_GPIO(slave0, GPIO_1 , 0);

I would go for the big monolithic firmware for ease of use, but you can go there progressively.

Afterward on top of that you can add any type of UI on the master to control all that, but for that part I'm not having any advice unfortunately, but running a web server can be a good idea, so that it will be accessible from anywhere and on mostly anything that can use a web browser.

1
  • You might also want to look into MQTT, it's a nice little protocol that is based on topic and subscribers, which can probably well fit your needs.
    – YCN-
    Feb 13, 2019 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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