• We make automation for a brewery on one board. We are studying atmega644. We make a board using photoresist. Automation for the BeerDuino brewery based on arduino mega Control of the change machine on Arduino

    In 2014, I came across a video of a man making beer from beer wort concentrate. I got excited about the idea of ​​brewing and then it started...
    Brewing beer from canned food became uninteresting to me after the 2nd time and I decided to switch to all-grain. Once I brewed beer on gas and realized that this was not my method. I decided to make it automatic. The evenings became more interesting. I got so involved in programming that I coded until 2-3 am. Tests were needed in real conditions. In the bins I dug up a boiler and a cut glass.

    And this is what I ended up with

    Now I’ll tell you how to make such automation.
    To begin, we will need the following details. I bought them in China.
    ssd1289 or ili9341.
    Solid state relay for controlling the heating element (or circuit diagram)
    Solid state relay for pump control, (for AC pump) or (for DC pump)
    Thermal sensor or or
    Power supply 7.5-9V 1A. For example
    Connectors for connecting a temperature sensor and a pump and
    (more )
    (buzzer)
    4.7 kOhm resistor

    Low voltage circuit

    Power circuit. Be careful. If you are not sure, trust the professionals.

    We take the wire cross-section depending on the total power of the pump and heating element. A solid heating element requires a radiator because... It doesn't heat up too much. We stuff it all into a box. We upload the firmware, configure it and brew beer.

    (instructions inside)

    But the basic functions were not enough for me. And I decided to turn on wifi. I bought an ESP8266 module on Aliexpress. At the same time I ordered the module because... The guys from the forum really asked to implement it into the project (you can do it without it). And connected according to the following diagram

    To power the wifi module we need a 5V power source. Arduino cannot be used. You can use a separate power supply or convert 9V to 5V. To do this, you can assemble a simple circuit with a voltage stabilizer or buy a ready-made one from the Chinese. For example (there are a lot of other options).

    The next step is to flash our module with NodeMCU firmware. Download. Let's launch. Click Start and wait for the firmware to finish uploading. Did you ask? That's great. Now we load the script. For this we need. There are of course other programs like . But I couldn't get them to work with my module. In ESPlorer we create a new file init.lua with the following content:

    Change the wifi network name and password to your own. Set the speed to 9600. Press the “Open” button (if it doesn’t connect, pressing the reset button on the module can help). And click “Save to ESP”. After downloading the script, the module should connect to your router. You can check this by logging into the router and looking at the DHCP clients. If your module is not visible there, then something went wrong.

    The web interface contains the following functions.
    1. Process monitoring. You can monitor temperature, pump status, mashing and brew performance. The web interface is equipped with an audible alarm.
    2. Load recipes into the controller’s memory and onto a flash drive.
    3. Construction of a global graph of the entire cooking process.






    Login to the web interface

    Automation in modern society is a necessary measure, because in the digital age it is extremely important to eliminate the human factor in various industries in order to standardize and improve the quality of products. There are also areas where humans simply cannot do what robots are capable of, for example, the production of nanomaterials and microcircuits.

    However, automation not only helps in production, but it can also be useful for the average person. For example, automation for a brewery using Arduino can significantly simplify the process of producing a product. Let's figure out how automation for rectification on Arduino and other things can help, and look at examples.

    The main advantages of automated systems based on the Arduino microcontroller

    No one is stopping you from soldering your own board and programming it yourself using low-level languages. However, automation using Arduino and ready-made microcontrollers will greatly facilitate the entire process and save time. After all, it is much easier to buy a ready-made product with a set of libraries and adapt it to your needs. And affordable automation on the Arduino mega 2560 can be useful in many areas of life, from voice switches for a smart home to electric latches with a motion detector. The main advantages that Arduino automation is famous for are:

    1. Low barrier to entry. There is no need to obtain an engineer's education; it is enough to watch a couple of training videos and have a foundation in programming.
    2. A large number of already prepared libraries. Arduino is used throughout the CIS by many robotics enthusiasts, to the point that the production of various electronics becomes their hobby. Accordingly, the user community online is extremely active, posts a large number of blanks and is ready to help you solve any problems. The quality of libraries suffers due to the low entry threshold, but no one forbids you to create your own; it is enough to study the semantics of the C++ language or use ready-made translators.
    3. A large number of peripherals. It doesn’t matter if you need Arduino-based greenhouse automation or a light sensor, you will find any modules, including sound sensors and voice recognizers. Yes, some boards cost a lot of money, but you can always find cheap analogues, for example, the esp8269 wi-fi module from third-party manufacturers, which costs 10 times less than the official one.
    4. A lot of information. Any problem you're facing has already been faced by someone else, and you'll probably find a solution on Google. There is also complete literature that you can consult.

    However, do not think that Arduino has no flaws. The board is famous for its low performance. In particularly complex tasks and with a large amount of code, the response time can reach 1 second, which is unacceptable for microcontrollers. The flash memory of most modules does not exceed 1 MB, which is not enough to create neural networks or use media files. Of course, you can connect an auxiliary memory card, but this increases the response time, takes additional resources to power it and is done in a semi-handicraft way.

    However, simple automated systems, for example, for brewing beer or greenhouses, do not require even a fraction of the resources that the board can provide. Accordingly, most users will find these shortcomings meaningless. If you decide to assemble your own 3-D printer or a more complex design, you should take a closer look at analogues. But the barrier to entry for Arduino’s competitors will be much higher.

    Example of process automation based on Arduino microcontroller

    The simplest example of process automation can be a greenhouse using Arduino. To create any system, it is worth clearly defining the tasks that it must perform. Using a greenhouse as an example, this would be:

    1. Creation of a special climate.
    2. Timely switching on and off of lighting.
    3. Timely watering of plants and maintaining air humidity at the same level.

    Based on these tasks, you can immediately notice what you will need to buy for the main board:

    1. Temperature sensor. It will ensure that the air does not heat up or cool down, being within the limits prescribed by the program. If the temperature changes, the board will turn on the air conditioner or electronic batteries.
    2. Light sensor. Of course, you can limit yourself to a software solution and buy expensive lamps that simulate daylight. But if you want to create a full-fledged greenhouse, then it will be much more convenient to install an automatic ceiling, which will be controlled by Arduino.
    3. Humidity sensor. Here everything is the same as with temperature, according to the prescribed scenario, the board will turn on sprayers and humidifiers, if necessary.

    When you purchase all the necessary modules, all that remains is to program them. After all, without code, these are just pieces of hardware that are not capable of anything.

    Programming Arduino microcontrollers for process automation. Example

    As in the previous point, for programming it is important to break the task into separate sub-points and perform them sequentially. Arduino programming occurs thanks to commands in the AT and AT+ interface, using prepared libraries. Accordingly, all scripts are written in a special environment in C++ and, before doing anything, devote time to studying its semantics. In addition to performing simple functions, the system is also capable of storing scripts in flash memory, which is what we need in this example.

    Don't forget that information from each sensor comes in real time and as variables, but you can limit the response time, since there is no need to spend resources and measure each parameter constantly. Accordingly, set the on and off time for each sensor or set the response time for a certain period.

    Why did I need automation?

    Automation is needed to facilitate the process, because... this controller itself will monitor the temperature, maintain it and raise it to the required temperature pause. You can also use an audible signal to indicate the necessary intervention, for example, you need to add malt or do an iodine test.

    I decided to make my own automation from a ready-made project. It runs on arduino, a temperature sensor, two relays, a display and buttons are connected to it. The first relay controls the heating element, the second relay controls the pump. The mashing pump is very convenient because... there is no need to stir the mash during the entire mashing process (I recommend reading my earlier ones for more details on how to brew beer)

    I assembled the first automation using modules:

    - Arduino mini
    - Block of two 15A relays
    - Display 2004
    - Temperature sensor
    - 4 buttons
    - 5 volt power supply
    The convenience of modular assembly is that it is not difficult to get all the parts and there is practically no need to solder anything. But the biggest disadvantage is the huge number of wires, and the cheap Chinese relay created interference on the display, so the mechanical relay had to be replaced with a solid-state one.

    Over time, I came to the conclusion that I needed to build my automation on a chip with 64kb of memory (Arduino mini has only 32kb) on one board. I didn’t find a ready-made solution, so I began to create a circuit myself and subsequently a board for my craft.

    Scheme:

    I developed and drew the diagram, so to speak, on my knees and for myself, so some shortcomings are possible, but the diagram is completely working:

    Pay:

    I drew the circuit, then it remains to draw the board, first I drew it using the program Sprint-Layout 6, very convenient, but it doesn’t have enough functionality, so I decided to move away from it towards the program DipTrace and this is what I got:

    You can download the sources.
    As you can see, I named my brewery QRBeer and this is already version 0.5...

    The board is ready, all that remains is to somehow manufacture it. For this I decided to use . Why them and not LUT? I just decided to try this new technology for myself, I already tried LUT, I felt it, so to speak, I won’t say that I liked it...

    Photoresist:

    To make printed circuit boards using photoresist you will need:
    - Printer film
    -
    - UV lamp
    - Soda ash

    UV lamp

    First, I’ll share information on how I made mine UV lamp. At first I wanted to use a ready-made lamp, and then I decided to assemble it using six 3W LEDs:
    and also purchased on Tao:


    I glued the LEDs to the radiator, although they could have been assembled on a PCB, I doubt that they would have overheated.
    Here's what I got:


    Board manufacturing

    1. So, I have prepared the template, all that remains is to print it on film. As I wrote above, I need a film for a printer, I tried the film for both a laser printer and an inkjet printer, the best option is obtained only with a film for inkjet printing. You need to print in negative and mirror image:

    I immediately laminated the template so that fingerprints and debris could be easily washed off.
    2. Next we need to sand our future board (fiberglass laminate). A slightly dampened regular sponge or melamine sponge is suitable for this:


    3. After this procedure, the copper still needs to be degreased with acetone:


    As you can see in my photo, I degreased it with a regular napkin, and I poured the acetone into a peroxide bottle, so it’s more convenient to take...
    4. The next step is to cut the photoresist slightly to fit your future board and carefully remove the top protective film so as not to damage it. If the photoresist is domestic, you need to peel off the matte side, if it’s Chinese, then there is no difference...
    5. Next, we glue the photoresist onto the PCB so that no air bubbles appear under the photoresist, otherwise the tracks will not appear in such places, cut off the excess...
    The process of gluing photoresist is similar to gluing a protective film on a phone.


    6. When the photoresist is glued, the textolite with it must be passed through a laminator 2-3 times or use a warm iron and ironed through a sheet of paper folded in half:


    The main thing is not to overheat the photoresist, otherwise it will turn out like this:


    If you get a “jamb” when gluing the photoresist, then it’s better to remove it (wash it off or scrape it off) and re-glue it, otherwise after etching the board it will be sad... I won’t remove this photoresist, I’ll show you the end result.
    7. Place a template on the PCB with photoresist and press it with glass (I took it from an old photo frame), and place a weight on the glass:


    8. We illuminate the photoresist using a UV lamp. My lamp lasts about 2 minutes:


    As you can see, the photoresist that was exposed changed color from light blue to dark blue, and the exposed photoresist is very fragile.
    9. Remove the glass and template. Excess photoresist can (optionally) be trimmed and carefully separated with tweezers:


    10. The next step is to wash off the undeveloped photoresist with alkali; to do this, take 2 glasses of water and a tablespoon of soda ash, stir well. Peel off the top protective film of the photoresist and dip our textolite into an alkaline solution.


    11. Take a brush and rub three pieces of photoresist in the alkali, gradually the undeveloped photoresist is washed off:


    You can not pour out the alkali, but leave it on the next board or to wash off the photoresist after etching, but more on that later...
    12. Board etching:
    There are two most accessible methods: etching with ferric chloride or peroxide + citric acid and salt. I won’t write about ferric chloride, but I’ll probably describe it using peroxide:
    - 100 ml. hydrogen peroxide 3% - it is sold in a pharmacy for 7-12 rubles
    - 30 gr. citric acid (available at any grocery store)
    - 1 tbsp. spoon of salt (both fine and rock salt will do)


    All this is mixed in a container and the board with the finished photoresist is immersed there, after a while bubbles appear on the board:


    And after some time, the “bare copper” will be completely etched:


    By the way, if you etch at a higher temperature, for example, with an incandescent lamp or in a water bath, then the etching will be reduced by three, the main thing is not to overdo it, otherwise the excess will etch...
    13. The most convenient way to remove the photoresist is in the same alkali in which the unetched photoresist was washed off; after 20 minutes it will fall off on its own and there is no need to rub anything...

    And here are my “jambs”:


    Although not significant, but still, carelessness is to blame for everything, did not notice air bubbles under the photoresist or overheated...

    I got the following board “clean”:


    14. Next, drill holes and tin the board:


    15. Solder all the parts and wash off excess flux:


    I soldered SMD components with a Chinese infrared soldering station, very convenient:

    That's all, the hardest part is over, all that remains is to test the tracks for short circuits and start programming the chip.

    Programming atmega644

    1. To start programming, you need to load the bootloader into it. This is not difficult to do using Arduino UNO, but first you need to download and install the program.
    2. The next step is to add or immediately take a ready-made assembly to the installed program:
    3. Upload the ArduinoISP sketch to the UNO:

    4. And connect our board to UNO:


    According to the sketch instructions:
    // pin name // slave reset: 10: // MOSI: 11: // MISO: 12: // SCK: 13:
    It turns out according to my scheme like this:

    5. Next, install our board in the settings and load the bootloader:




    If everything went well, we will see the message: “Bootloader recording complete”
    At this point, the loading of bootloader"a is completed, you can connect the display, buttons, temperature sensor and fill

    Many people today dream of living in a “smart” home. But commercial solutions nowadays are repulsive due to their considerable price. Fortunately, you can make your own home automation system using cheap and readily available components.



    This material will show you how to control household appliances, in our case lamps, using an Android device and Arduino. Moreover, even if you are new to programming and have no experience in writing Android programs, you will be able to complete this project without any problems.


    The project will require a few elements: an Arduino board or any clone, a TTL-UART Bluetooth interface module with an operating voltage of 5 V, several relays and a driver (control circuit) for them, and, of course, a smartphone or tablet on Android.


    This project includes two separate parts: a hardware control circuit and an Android application. Communication between the control circuit and the Android application is carried out using a Bluetooth wireless interface. ASCII commands are sent from the phone to the Arduino, which are further decrypted and represented as commands to turn on or off a specific household appliance.


    Developers of applications for Android devices mostly know the Java programming language, but in this case knowledge of this language is not required, since there is a fairly simple and understandable online development environment, App Inventor, created at MIT. It is specially created for people who do not understand Java programming, and offers to assemble an application visually from blocks of operations. This is what our Android program looks like:



    You can download the source code of the program, consisting of blocks in App Inventor, and the program itself with the apk extension.


    Now you need to assemble the circuit, as shown in the figure below.



    Please note that the RX line on the Arduino must be connected to the TX line of the Bluetooth module, and the TX line on the Arduino must be connected to the RX line of the Bluetooth module.


    To program the Arduino board, you must have the Arduino IDE installed. Below is a sketch for Arduino.


    const int led1 = 2; const int led2 = 3; const int led3 = 4; const int led4 = 5; byte serialA; void setup() ( Serial.begin(9600); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); ) void loop() ( if (Serial. available() > 0) (serialA = Serial.read();Serial.println(serialA);) switch (serialA) ( case 1: digitalWrite(led1, HIGH); break; case 11: digitalWrite(led1, LOW); break; case 2: digitalWrite(led2, HIGH); break; digitalWrite(led2, LOW); break; case 4: digitalWrite(led4, HIGH); case 44: digitalWrite(led4, LOW);

    After you have recorded the sketch in Arduino and installed the application for Android, you need to connect to the Bluetooth module from your phone. To do this, turn on the power to the Arduino and the Bluetooth module and activate Bluetooth on your phone, making it visible to all devices as well. After that, you can find this module in the search list for other Bluetooth devices. Enter the pairing code, which is usually "1234" or "0000".



    In this case, the device you are pairing with will have a name. After pairing, turn on the EG-HOME application and press the Bluetooth button to select the paired device in the program. After this, your phone will be connected to the control circuit, and by pressing the corresponding buttons you will turn the lamps on or off.