Posts | Comments

Planet Arduino

Archive for the ‘PID’ Category

We’re all familiar with the experience of buying hobby servos. The market is awash with cheap clones which have inflated specs and poor performance. Even branded servos often fail to deliver, and sometimes you just can’t get the required torque or speed from the small form factor of the typical hobby servo.

Enter [James Bruton] and his DIY RC servo from a windscreen wiper motor. Windscreen wiper motors are cheap as chips, and a classic salvage. The motor shaft is connected to a potentiometer via a pulley and some string, providing the necessary closed-loop feedback. Instead of using the traditional analog circuitry found inside a servo, an Arduino provides the brains. This means PID control can be implemented on the ‘duino, and tuned to get the best response from different load characteristics. There’s also the choice of different interfacing options: though [James]’ Arduino code accepts PWM signals for a drop-in R/C servo replacement, the addition of a microcontroller means many other input signal types and protocols are available. In fact, we recently wrote about serial bus servos and their numerous advantages.

We particularly love this because of the price barrier of industrial servomotors; sure, this kind of solution doesn’t have the precision or torque that off-the-shelf products provide, but would be sufficient for many hacks. Incidentally, this is what inspired one of our favourite open source projects: ODrive, which focuses on harnessing the power of cheap brushless motors for industrial use.

There are few scenes in life more moving than the moment the solder paste melts as the component slides smoothly into place. We’re willing to bet the only reason you don’t have a reflow oven is the cost. Why wouldn’t you want one? Fortunately, the vastly cheaper DIY route has become a whole lot easier since the birth of the Reflowduino – an open source controller for reflow ovens.

This Hackaday Prize entry by [Timothy Woo] provides a super quick way to create your own reflow setup, using any cheap means of heating you have lying around. [Tim] uses a toaster oven he paid $21 for, but anything with a suitable thermal mass will do. The hardware of the Reflowduino is all open source and has been very well documented – both on the main hackaday.io page and over on the project’s GitHub.

The board itself is built around the ATMega32u4 and sports an integrated MAX31855 thermocouple interface (for the all-important PID control), LiPo battery charging, a buzzer for alerting you when input is needed, and Bluetooth. Why Bluetooth? An Android app has been developed for easy control of the Reflowduino, and will even graph the temperature profile.

When it comes to controlling the toaster oven/miscellaneous heat source, a “sidekick” board is available, with a solid state relay hooked up to a mains plug. This makes it a breeze to setup any mains appliance for Arduino control.

We actually covered the Reflowduino last year, but since then [Tim] has also created the Reflowduino32 – a backpack for the DOIT ESP32 dev board. There’s also an Indiegogo campaign now, and some new software as well.

If a toaster oven still doesn’t feel hacky enough for you, we’ve got reflowing with hair straighteners, and even car headlights.

Experience — or at least education — often makes a big difference to having a successful project. For example, if you didn’t think about it much, you might think it is simple to control the temperature of something that is heating. Just turn on the heater if it is cold and turn it off when you hit the right temperature, right? That is one approach — sometimes known as bang-bang — but you’ll find there a lot of issues with that approach. Best practice is to use a PID or Proportional/Integral/Derivative control. [Electronoob] has a good tutorial about how to pull this off with an Arduino. You can also see a video, below.

The demo uses a 3D printer hot end, a thermocouple, a MAX6675 that reads the thermocouple, and an Arduino. There’s also an LCD display and a FET to control the heater.

The idea behind a PID controller is that you measure the difference between the current temperature and the desired temperature known as the setpoint. The proportional gain tells you how much output occurs due to that difference. So if the setpoint is way off, the proportional term will generate a lot of output to the heater. If it is close, only a little bit of output will result. This helps prevent overshoot where the temperature goes too high and has to come back down.

The integral term adds a little bit to the output based on the cumulative error over time. The derivative term reacts to changes in the temperature difference. For example, if something external causes the temperature to drop suddenly, the derivative term can goose the output to compensate.

However, the operative word is “can.” Part of setting up a PID is finding the coefficients for each term which for some systems could be zero or even negative (indicating a reverse effect).  There are a lot of other subtleties, too, like what happens if the output stops affecting the temperature for a long period and the integral amount grows to unmanageable magnitude.

By the way, we’ve covered a PID library for Arduino before. While this post talks about temperature, PID control is used for everything from flight control to levitation.

Hackaday readers don’t need an introduction to the Arduino. But in industrial control applications, programmable logic controllers or PLCs are far more common. These are small rugged devices that can do simple things like monitor switches and control actuators. Being ruggedized, they are typically reasonably expensive, especially compared to an Arduino. [Doug Reneker] decided to evaluate an Arduino versus a PLC in a relatively simple industrial-style application.

The application is a simple closed-loop control of flow generated by a pump. A sensor measures flow for the Arduino, which adjusts a control valve actuator to maintain the specified setpoint. The software uses proportional and integral control (the PI part of a PID loop).

Although the Arduino has a good selection of I/O pins, it doesn’t have common I/O capabilities you’d expect in an industrial controller. For example, the flow meter used in the demo produces a current proportional to flow ranging from 4 mA to 20 mA. That’s a very common set up in an industrial device since current loops are able to handle long wire runs, along with other reasons. [Doug] found he had to create a converter to get the data to the Arduino. He also needed a way to convert the Arduino’s PWM output to a 4-20 mA output, which was even more complicated.

Of course, the PLC had all of these options already, along with a user interface suitable to the task. From that [Doug] drew the conclusion that while the basic hardware was cheaper, it was a wash by the time you added the ancillary components. He also felt that the engineering time to build the Arduino version of the project swamped all the costs of using the PLC.

In general, we don’t disagree. However, it depends on what you are trying to accomplish. While a hammer is good at driving nails, it isn’t good with screws. You need the right tool for the job. If you really had 4-20 mA gear and needed a PLC-like user interface, then, of course, the PLC is probably the right choice. However, if you had started with the Arduino, you could have selected better flow monitoring and actuator choices, provided better power, and used a user interface more suited for the Arduino and gotten a better result.

Don’t get us wrong. PLCs have a place. So do Arduinos. So do ARM chips, Raspberry PIs, and 555 timers. For [Doug’s] project a PLC was clearly the right answer. That doesn’t mean it is always the right answer. However, we did think seeing the comparison between the two might help PLC experts understand the Arduino better and vice versa.

Although most PLCs are proprietary, we’ve covered OpenPLC before. Maybe the best idea isn’t to pick one or the other, but use both and play to their strengths.


Filed under: Arduino Hacks

If you’ve ever tried to tune a PID system, you have probably encountered equal parts overwhelming math and black magic folk wisdom. Or maybe you just let the autotune take over. If you really want to get some good intuition for motion control algorithms, PID included, nothing beats a little hands-on experimentation.

To get you started, [Clovis] wrote in with his budget propeller-based PID demo platform (Portuguese, translated shockingly well here).

The basic setup is a potentiometer glued to a barbecue skewer with a mini-quadcopter motor and rotor on the end of it. A microcontroller reads the voltage and PWMs the propeller through a MOSFET. The goal is to have the pendulum hover stably in midair, controlled by whatever algorithms you can dream up on the controller. [Clovis]’ video demonstrates on-off and PID control of the fan. Adding a few more potentiometers (one for P, I, and D?) would make hands-on tweaking even more interactive.

In all, it’s a system that will only set you back a few bucks, but can teach you more than you’d learn in a month in college. Chances are good that you’re not going to have exactly the same brand of sardine can on hand that he did, but some improvisation is called for here.

If you don’t know why you’d like to master open-loop control algorithms, here’s one of the best advertisements that we’ve seen in a long time. But you don’t have to start out with hand-wound hundred-dollar motors, or precisely machined bits. As [Clovis] demonstrates, you can make do with a busted quadcopter and whatever you find in your kitchen.


Filed under: Arduino Hacks

If you have a good sense of balance, you can ride a unicycle or get on TV doing tricks with ladders. We don’t know if [Hanna Yatco] has a good sense of balance or not, but we do know her Arduino does. Her build uses the ubiquitous HC-SR04 SONAR sensor and a servo.

This is a great use for a servo since a standard servo motor without modifications only moves through part of a circle, and that’s all that’s needed for this project. A PID algorithm measures the distance to the ball and raises or lowers a beam to try to get the ball to the center.

Servos like this usually operate in radio control vehicles and they are very easy to drive. A pot coupled to the shaft generates a pulse that the servo internally compares to a pulse from the microcontroller. If the pulse is wider than the reference pulse, the motor drives in one direction. If the pulse is narrower than the reference, the motor operates in the other direction. Just how much it drives depends on how much difference there is between the two pulses. When the pulses match, the servo motor stops moving. This pulse arrangement is very simple to drive from a logic output on an Arduino or other microcontrollers.

The build details are a bit sparse, but you can see in the video the general layout, and she links to a similar project that inspired this one if you are looking for more details.

You can do the same trick in two dimensions if you prefer. Or perhaps you’d like to try using a time of flight sensor, instead.


Filed under: Arduino Hacks
Giu
08

Building a quadcopter running on Arduino Yún

arduino, Arduino Yún, Drones, Featured, Motors, OpenWrt, PID, Yun Commenti disabilitati su Building a quadcopter running on Arduino Yún 

Comelicottero

Comelicottero is a quadcopter based on Arduino Yún created during the Master in Computer Science at the Universita’ degli Studi of Milan (Italy) by Simone Castellani, Giovanni Intorre and Andrea Toscano:

The idea was to build a drone able to be controlled through WiFi from any PC, tablet or smartphone . Comelicottero is equipped with an accelerometer and a gyroscope for the stability obtained by a PID-based control system. Since Servo library is too slow for the quadcopter dynamics, an hardware PWM was implemented to obtain a 400Hz PWM signal.

The communication between the ground station on a PC and the quadcopter relies on WiFi and, in order to get better results, Bridge library was replaced with an efficient python script on OpenWRT-Yun. On top of that all the code was written to maximise Arduino Yún capabilities. The Navigation System has been designed, simulated on PC, implemented and tested. The autonomous navigation is going through an additional testing due to magnetometer interferences with motors’ magnetic field.

The user can control and monitor data coming from the drone using a gamepad attached to a laptop with a custom software installed.

Comelicottero_PC_Ground_Station

The sketch and all the documentation will be soon available on GitHub and released with GNU license. In the meanwhile follow their Youtube Channel for updates.

 

Comelicottero_Wiring

Set
13

Temperature controlled reflow oven build

arduino, PID, Reflow, reflow oven, soldering Commenti disabilitati su Temperature controlled reflow oven build 

IMG_1187-Copy

Matt of SkyLabs has a nice build log about a temperature controlled reflow oven he built using an Arduino based PID controller and a standard toaster oven:

We have successfully managed to build a temperature controlled reflow oven using an Arduino based PID controller and a standard toaster oven from Robert Dyas! This is a must have accessory for any hobbyist who regularly uses surface mount components within their designs. Below we have a build log documenting the process of constructing the oven including:
Teardown of the original oven
Custom enclosure construction
Control Methods
Arduino Installation

So to start off I will outline a basic parts list of what I used:
Arduino Uno
Reflow Oven Shield
Solid State Relay
K-Type Thermocouple
230v AC to 5v DC Power Supply
Custom Laser Cut Enclosure

[via]

Temperature controlled reflow oven build - [Link]

Giu
18

Reflow Oven Controller with graphics TFT

arduino, control, controller, JD-T1800, Oven, PID, Reflow, ST7735R, TFT Commenti disabilitati su Reflow Oven Controller with graphics TFT 

CycleWithOverflow

0xPIT @ github.com writes:

This Reflow Oven Controller relies on an Arduino Pro Micro, which is similar to the Leonardo and easily obtainable on eb*y for less than $10, plus my custom shield, which is actually more like a motherboard.

As I believe it is not wise to have a mess of wiring and tiny breakout-boards for operating mains powered equipment, I’ve decided to design custom board with easily obtainable components.

The hardware can be found in the folder hardware, including the Eagle schematics and PCB layout files. It should fit the freemium version of Eagle

Reflow Oven Controller with graphics TFT - [Link]

Gen
27

Open source PID controller (DIY Arduino shield)

arduino, PID Commenti disabilitati su Open source PID controller (DIY Arduino shield) 

stripboard-pid-resized

Tom posted his Arduino PID controller shield in the dangerous prototypes project log forum:

Program a temperature profile to mash beer or reflow solder. Here’s how.

This full featured open source PID controller uses a DIY stripboard shield for Arduino Uno and compatible boards. Firmware based on osPID massively revamped and extended, blood was sweated over new auto tune routines. Standalone or remote operation over UART using Java GUI. All documented on Github with BOM, schematics, code, pictures etc. Parts cost about $15, external SSR module and Arduino required.

I spun this project as a kit for Tayda, with the idea that all the components could be cheaply ordered in one place.

Open source PID controller (DIY Arduino shield) - [Link]



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook