Arduino Controller ?

Thread Starter

Assalind001

Joined Jun 24, 2024
4
I'm new to Arduino and need some advice.
I have a small machine with 2 pneumatic cylinders, 1 stepper motor, 4 limit switches on the cylinders, a Door switch, and a couple of push buttons (start, stop etc).
Anyone got a recommendation for an Arduino controller?
 

Thread Starter

Assalind001

Joined Jun 24, 2024
4
I need to index a stepper, drive a couple of air cylinders IN & OUT. A Push button to START and push button to STOP if it all goes wrong. :)
Guess I'm asking would an Arduino controller do the job
 
The Arduino UNO R3 is a good choice for this kind of project. The main issue is often the number of I/O lines you need, so the first step is to count them!

I’m counting 2 x 2 = 4 for the valves for the pneumatic cylinders, 4 for the limit switches, 4 for the stepper motor, 1 for the door switch and 2 for the push buttons. That’s a total of 15. The UNO has 13 digital I/O lines but don’t use 0 and 1 as they are used to talk to the computer, and 6 analogue lines which can also be used for digital. So you have sufficient I/O.

The maximum current output of each pin is 20mA so you will need transistors to drive the pneumatic valves. The push buttons, limit switches and door switch can simply ground a pin which has pinMode set as input with pull-up. Use an H bridge IC for the stepper, or a ready made module.

If you are new to the Arduino I recommend trying some of the examples first. Then write code to turn on an LED when a button is pressed - in other words do individual stand alone tasks to verify they work and as you build the whole system only make one change at a time, testing every step before moving on.
 

LesJones

Joined Jan 8, 2017
4,236
Your sequence table in post #5 does not give any timing information between events.
Also as many stepper motors are 200 steps per revolution 22.5 degrees would be 12.5 steps. This would require a stepping motor controller that was capable of half stepping. (Or a 2:1 reduction gearing on the stepper motor output.) How much time is required to move 22.5 degrees ?

Les.
 

Thread Starter

Assalind001

Joined Jun 24, 2024
4
Your sequence table in post #5 does not give any timing information between events.
Also as many stepper motors are 200 steps per revolution 22.5 degrees would be 12.5 steps. This would require a stepping motor controller that was capable of half stepping. (Or a 2:1 reduction gearing on the stepper motor output.) How much time is required to move 22.5 degrees ?

Les.
2:1 Reduction.
 

Ya’akov

Joined Jan 27, 2019
9,275
Welcome to AAC.

Your project is very basic, even the smallest of Arduino-compatible MCUs is likely to work, but—

Let’s clear something up first:

Arduino means more than one thing, and doesn’t mean something it is often used to denote.

Arduino is an organization, a development environment/platform, and is also used to name several development boards containing MCUs and assorted hardware, designed and produced by the Arduino organization. (as well as various clones, which is legitimate since Arduino’s work—hardware and software—is open source)

It is not, correctly used, a generic name for any development board that is supported for use with the Arduino IDE. And here’s where you need to think carefully. To be very clear, there is absolutely nothing wrong with Arduino’s dev boards. They are robust, they work well, and they are certainly going to be supported fully.

But, there are so many alternatives it is important not to assume an Arduino dev board is the best choice for you. Historically, Arduino’s boards are based on Atmel MCUs, the most “popular” being the Uno, using an ATmega328P.

Atmel chips are quite nice, and they are inexpensive. They can be programmed using the Arduino IDE then removed from the dev board and with minimal external components be embedded directly into your project. The Atmel line includes ATmega MCUs which are larger (both physically and in terms of peripherals and memory/storage) and ATtiny MCUs which can be as small as an 8-pin DIP or SMD package and are surprisingly capable—in fact, one could probably run your project.

As in all of the cases, it comes down to the available GPIO and peripherals when deciding on an MCU and/or dev board. The GPIO is simply a way of reading or writing true and false values as electrical signals so you can sense or control things. This is the most basic type of interface and the number of pins on the package is an indication of the limit for a given MCU.

For example, the ATtiny13A is an 8-pin MCU, very cheap, but exceedingly useful. Consider that we need one pin for power, and one for 0V (“ground”) leaving 6. These six pins mean you have six GPIO possibilities with the 13A. You can programmatically change the function of a pin, so it can be set as Input then changed to Output if that’s required.

The ATtiny85 looks just like the 13A. The difference lies in the size of the memory and the peripherals. Look at this chart:

1719306695732.png

You can see the difference in memory (1KB vs. 8KB of flash, and 64B vs. 512B for EEPROM and SRAM), and in the peripherals where the 85 doubles the timers and PWM channels. The tradeoff comes in the power consumption and cost.

These things are not going to impact your project but I mention them so you can understand what makes one MCU different from another. Comparing the ATtiny85 to the Uno’s ATmega328p—

1719307227455.png
And you can see, it is similar, with the key things being GPIO (6 vs. 23!); an additional timer (16-bit); 2 more ADC channels; hardware support for UART, SPI, and I²C; and as in the case of the previous comparison, increases in power consumption and cost.

Some very popular boards are based on the Espressif ESP range of MCUs. A key difference being the integration of wireless technology and cryptographic hardware. ESP MCUs natively support things like Wi-Fi and Bluetooth and can be very powerful for IoT projects. They range in cost from very cheap to fairly pricy, depending on capability. You can compare the line as above looking at the datasheets for key features.

A direct recommendation is to consider the Seeed Studio XIAO family of development boards. (Not a typo, there are three e’s in Seeed). These have the advantage of offering a range of architectures, extensive Arduino support, and reasonable pricing in a small package with a modern Type-C connector.

There are Microchip SAMD21 versions (Microchip owns Atmel, and like the AVR (AT) series these are ARM based), Espressif ESP32 versions, and even RP2040 versions (the MCU designed by the Raspberry Pi foundation with some interesting features). Because the form factor and accessories will be held constant as you explore different architectures, the XIAO can simplify learning about the various options available.

You can find the XIAOs on AliExpress and Amazon, and you can easily use them with the Arduino IDE, and so an enormous number of libraries that simplify your programming.

Good luck, ask any questions you have!
 
One extra thing I should mention. I assumed in my post #7 that all the control would be done using the Arduino I/O together with the necessary code and drive electronics but when you are making a system with moving parts you should consider safety issues. For example, should the door switch and the STOP switch be hard wired to simply cut power to the driven devices?
 

Ya’akov

Joined Jan 27, 2019
9,275
…when you are making a system with moving parts you should consider safety issues. For example, should the door switch and the STOP switch be hard wired to simply cut power to the driven devices?
I intended to say something similar but was distracted. The interlock on the door can have two effects—one as a signal to the MCU and the other as a disconnect of the power to anything that can move. That way, if there is a problem with the program it can’t do any harm when the door is open but you can still use programmatic control based on the door sensor.

Were I paranoid—sometimes things are out to get you—I might make the interlock prevent restoration of power if the MCU has attempted to operate the device with the door open and possibly even reset the MCU. It really depends on how much danger there is.

EDIT: An e-stop button should never rely on an MCU to operate, it should just remove power from everything that can move. It’s OK to signal the MCU that e-stop was activated for additional actions, logging, etc., but it should never just be a signal to the MCU—that’s not an e-stop!
 
Top