Arduino в Proteus БЕЗ Написания Кода. HX711 и тензодтчики. Делаем электронные весы

Arduino в Proteus БЕЗ Написания Кода. HX711 и тензодтчики. Делаем электронные весы

Show Video

Hello Friends, this is the MBS channel Electronics. Today I am returning to the topic of visual programming Arduino in Proteus Professional at the request subscribers. It will be very long, Very detailed video. On the record which it took me several days in fact, Therefore, a request Like right away. If You watch the channel without subscription, then be sure Subscribe, this will help the channel.

Subscribe also to my Telegram channel, all links will be in Description. Also in Description You will find links to All materials to this video. You will find in the archive Project for Proteus 8 and my application, terminal that I am I use to communicate with arduino. Here are such tenshoders came to me with Aliexpress for this project. This is three -high

sensors. In each such sensor there are Two Tenza resistor. That is, it is half a moment. You can also order four -over Sensors with a full bridge. It will be even better. But these are here Three -pin sensors, they just very much cheap, so I ordered them. for the firmware of arduin, which will work with these sensors, in principle, There is no difference, it will be Only the scheme differ Connections. Yourself The tensoresistors are here,

under the compound. When you fix the sensor, in your designs It is necessary that he relies precisely Here on this frame. Then the sensor will work That's right. The measured weight is used here, on this pimpochka. For installation I have developed a 3D model of a special frame, I will print on 3D printer. This model is also You will find in the archive to this video. Data

Tensodels designed for maximum weight 5 kilogram. That is Using four sensors, We can do Libra for maximum weight 20 kilogram. For work There are such tensodists Special ACP, It is called HX711. And in

China can be ordered Very cheap boards based on This microcircuit. Analogycifre converter HX711 has a resolution of 24 bits and developed Especially for tensodists with a pavement structure. At the ADC, which is built into microcontrollers, Resolution Not enough to work with such sensors. At measurement of voltage weight to such a way out The sensor changes very weakly. Therefore Correctly catch these changes, We need at least a 24-bit ADC. For workerYou are with ADC HX711 There are several libraries for the standard environment Arduin, also a library to work with them It is built into the proteus. Basic

Such a sensor is Two special resistors, which can change your resistance under The action of deformation. This is called tensile effect. IN those sensors that I received from China resistance of resistors 1 kOhm, at other sensors The resistance of resistors can be others. This is a scheme connection of one sensor to

Plant based on HX711. Since this ADC is designed for connection four output sensor with full bridge, then There are four resistors, then to use one sensor We need to add two additional resistors resistance 1 con. To the Arduin Module connects four wires, plus food, Minus power, conclusion data and synchrosinal conclusion. If we want use several at the same time ACP board in our project, then for each board We will have to use it Two conclusions of Arduin. In simple projects can use only one ACP and Connect several sensors to it. This is what the scheme looks like Connections of two identical sensors to the ADC board. Here we no longer need

additional Permanent resistors, because that two sensors naturally form Full bridge. This Connection scheme of four sensors to one ACP board. We connect two the sensor sequentially and from two pairs sequentially Connected sensors are full Bridge, as in the previous scheme. I have scales

will be from four sensors, so we will use today This is the inclusion scheme. No one bothers you Use in this project One sensor or two sensors, everything will be work exactly the same As with four. You can also buy one sensor with four conclusions.

four outlet sensor Inside corresponds to this scheme, so it will also be without problems Work in ours project. Just four outlets sensors are a little more expensive. In fact, for work with these tensodists through ACP 711 there are several libraries that can be used in a standard environment Arduin, but we will be today do everything in Prateus. Our task islie down Digital scales for arduin precisely Using the visual editor Prateus. Press the New Project, the master of creation opens project. Let's call our project somehow.

I will call MBS HX 711, Create a new folder, call MBS Scales, That is, the Libra is visual. Call our daddy with you. And here we will put our project.

Press further here You can choose the size of the sheet, where we will draw a diagram. There is no particular difference, This will set the size, so to speak Working field in the plan compilation of fundamental schemes. Press further.

In this tab, a master It also offers us to create a project printed circuit board, we do not need it. Press further We leave here by default do not Create PCB Layout. Press further. The master requests us Will we create a project Firmware. Yes, we will do The firmware project is precisely in Prateus.

Choose the third here Create FlowCard Project. This means that we We will just create a project for the visual editor. Prateus visual The editor is called FlowCard. family, choose Arduino, there really is Understand Pashche. I will choose the controller Arduino Uno, you can choose Nano, You can choose a un. Well, I have here On the table Arduino Uno, so We will create a project for her.

And here is the third point, This is a compiler, we need to choose Visual Designer for Arduino. there is Compiler setting button. After installing Prateus In general, you should have everything here is filled like mine. But in some cases In the Visual Designer for line arduino avr with us There may be an empty line here. in this case, if Here here is so empty line, you need here From here to copy this line and insert here. because The same compilers are used, what for Arduino avr, what for the visual editor.

Press further. The total here Information, we can check if everything is We are normal. If something is wrong, then We can go back and click finish.

If you have big Complex project, large algorithm, there are a lot of programs, they Everyone does not fit here on one sheet, You can create new sheets. There is a special one The component called Interconnector, which allows you to continue the algorithm on different sheets or on one sheet, like this to different columns Create a combination of our logic parts of algorithms. This is just a set of setup. This is the part of the code, which is performed at the time of start our program. Conventional editor Arduino standard, and we see here Sketch's harvester. Always Arduino creatures for us Setap and procedure Lup.

a magnifying glass is the main cycle our program, and the setup is what is performed during the start. Usually in the Setap function Placing the initialization commands some modules Microcontroller, Pino configuration, controller and so on. After completion Functions Setap Program falls Here, in this cycle, which is endlessly spinning while our microcontroller works.

The same here, in The workpiece of our visual, so Say, we have a sketch There is a setup function, this, and there is the main cycle of the program. There is one here Subtlety, this is relevant if you have on the computer Simultaneously with the proteus installed Arduin ide, that's how mine. in some cases This visual program to the proteus, c which we use the ACP module 711, may not compile. The program cannot compiled, one and that will be repeated. The error. If you have installed Arduin Ide and if you have it Library for this ADC 711, you need this library temporarily remove, stupidly Delete from the library directory Arduin.

For this in Arduin Idea We are walking the Properties file, and here is We have a path here, Here in this line is called Sketchbook location, we Copy this location. Open in the conductor or in Total Commander, we see here Libraries daddy, and if We have a folder here, which is called somehow HX711ADC, or just HX711, you need this Delete the folder. What I did, I just I took it, flashed it in zip Archive and then the folder itselfAlil is temporarily. If I want Work with this library later In Arduin Ide, I'm just I will open back this daddy, here she is like this called on my computer Hx711 Emphasizing ADC. Well, for some reason they are incompatible. It turns out that when Proteus picked up compilations This library is not from its folder, which is built to the proteus, there is its own The version of this library, namely from the library, which Located in the ARDUIN Library folder.

And I can’t do anything about it. Let's add the right one to our project The periphery. In our idea, we are with you Arduin will communicate with a computer via a sequential port, through UART. there is also here One slight subtlety. We already have The periphery added by default, which is called CPU, This is just our microcontroller from Mega 328.

Here we see Some peripherals on the device which is located Inside the microcontroller. This is Timer 1, this is Interface SPI, Interface i2c, we have iprom, we will use it. And we have ordinary Uart, that is, consistent Port. We will use Consistent port and iprom.

Let's activate them. For this, click on right button and select Enable periphery. everything, we have turned on Now the UART module, which is built -in In the controller. And also let's activate iprom. iprom it Energy -dependent memory, which is in the composition microcontroller from Mega 328. In IPROM we will Save calibration coefficients for our specific sensor.

Tenza sensors There is a huge number, and from an electric point vision they all work absolutely the same, but they have Everyone has different parameters. They are designed for different weight, maximum, they have differs voltage, let's say per kilogram of weight. Therefore, when working with a specific sensor, with that sensor, which you have in availability, in our program you need Provide the calibration procedure. The program calculates calibration coefficients in accordance with with some famous weight. We put on our Libra is some object known on the mass, Pre -For example, weighing it on other scales. and the program calculates calibration coefficient and records He in the energy -dependent memory.

In order not to do it Every time we turn on our Libra, let's also turn on the prom. Press "Enable Peripherial". yes, now if we open A branch that corresponds to e-Prom, click here Here on the pimpochka, we see five functions that we can Use in our program, just dragging here. So Taking to our visual algorithm, We can use these functions.

The same is from UART. We have a function here "Setup", which sets speed. We can choose 9600, by The default is with us 19200, 57600, 115200. These are standard consistent speed port.

for UART there is One slight subtlety. If we just turn on Uart, for some reason he will work wrong. such and such a jamb of a proteus actually. Add the procedure "Setup" this node, install 9600, but in reality this will not work. It turns out not a coincidence of speeds.

and what speed you Not installed, here in the "Setup" procedure, Yes, here, any speed You install This does not solve the problem. In fact, this is some kind of bug of a proteus. Well, it turned out that It is quite simple to be treated.

Choose a line Peripherals, the right button "Add periphery. " The window "Project Clip" opens. Project Clip is prepared in the proteus, as it were, workpieces some real existing boards, addition to Arduino. All these Additional boards they are grouped by different tabs. Open the “Group” liner.

Here we need to choose This is the "Group-Terminal-Module". Choose it, click "Add." In fact, this is a module for working with UART. After we Add this “peripheral module "Grump-terminal", We already have our built -in UART will work absolutely correctly.

with the right one All our messages will be speed Take and Displayed completely correctly. Let's switch Here on the schematic "Kepcher", on Scheme window. This is the module of "Arduino-uun."

And this same Module "Group-Terminal", which We just added with you. We do not need anything here to connect, no need to pull No wires between Arduino fees and this board "Group". everything is already connected by default. We just need to add it here.

Now we need Add the ACP-X-EX-711 module. Click the right The mouse button here on the "layers periphery and add the “periphery”. the module we need is In the tab "Brek-Aut-Perifer". The module is called “Arduino-Eich-X-711-4 Lotsel-Brekl-Aut-Brot.” Here we are Add and close this window.

These are functions that We can use it module. Actually, there is here Everything you need to work with This "ACP". We go to the diagram Schematic "Kepcher" here we see, What did we have the same module we need. Here he is. for our work Firmware from the real board "Arduino" This is already enough But we also want to see how it will be work in the simulator before flash our Ardunki.

Yes, this can be done here in "Proteus" because "Proteus" First of all, this Simulator of electronic circuits. We will add another module here. We will add this Standard library module "Proteus". from this window of the scheme. Press here on "Bukovka" Pi "and here we need to enter The word "Load Cell". And here it is, this module, The component we need.

Actually, this is a component. Here he appeared here We have in the list of components. Wipe it here. This will allow us Simulate our scheme here in "Proteus" see how it will work.

Before flashing Varduino. This conclusion we We connect this contact. Yes, this is a plus of food. Combine the Earth here.

This conclusion we connect here. And we connect this conclusion like this. We press the right button on this sensor and "Edit Property". Watch what properties we have.

This is a step with whichp. We have two here buttons that change our weight. Until we launched Our program for execution, You can add here as if the initial weight, that is, Tara weight. You need to understand what is this our kilograms Now, these are kilograms.

And here STROP, I prefer to put in accordance with The parameters of our real sensor. We have resistance The sensor resistors are 1 kilo, We will write here 1000 ohms. If I, for example, I wrote a program in the editor "Arduino" with his hands, so To say, in the language of SI, then I would first initialized the sequential port. installed a setup here, and some would write speed The work of the port.

In fact, Since we have this module, Here is this load in terminal, then we do not It is necessary, initialization will be carried out automatically we have. At the beginning of work, I want Display from some message, greeting some to see that our program has launched and everything is fine. We will open this module "Cargo to the terminal", there is We have the function "Print Ln ", drag it here here, We click on this module, Here we have a line "Arguments", here you need quotes Write a line that we want Bring out on Terminal at the beginning of our work. I will write "Hello" - MBS Electronics. Let's see Will our program work, for this we do not Be sure to flash this program in Arduino, we can do everything Watch in our proteus, in the simulator. Press the button here "Play", launch our program for execution, opened Virtual terminal and we see "Hello" mbs electronics.

ok, our program us greeted, then I want to make a temporary delay, say, one second. for this we have here Such a standard node is called "Time Delay", We drag it here here, click on it and set the delay 1000 ms, that is, one second. After that we need calibrate the scales for zero, not calibration sensor, and eliminate The influence of some weight that There is always on sensors in real scales, that is, This is installation of containers, weight Tara, well or zeroing of weights, who worked with ordinary Libra, yes, with kitchen, for example, electronic scales, There is such a tara button, Zira there, some Set the button to zero. These modules can simply Copy, copies, paces, here So we will insert it here and write here input t for zero scales, that is, introduce Enter the letter T to zero scurry.

here we are starting Program, passes one second And we get an Input t for zero scales. You may notice What in the simulator we had more than one second, this is because Simulation does not go In real time, simulation goes slower than If we poured this in a fee Arduin. Here in the urt module We have such an Input function, We drag it here here, click on it, open properties, here It is necessary that an echo is installed, It means that When we enter the letters kuta, we have The terminal will send it back to us. here, where it is written result, result, we need to choose The variable where What we will be recorded introduced. by default, proteus created an input variable for us, Here it is here, this A list of variables that are in our project. There is an input variable type String, if we have here There were still some String type variables, for example, I can Add string 1 here, Let it be also like String, then here, in the falling I can already choose some kind of list another variable.

you need to keep in mind that in the visual editor everything we have variables, which we announce, here which we add, in any module, in any Node, that's it Variays are global. All variables we have These are that we have in program, they are visible From any place, from any procedures, from any The module of our visual algorithm, Okay. Further program I must check if really The user introduced exactly the letters of the Kuta. for verification we have Here is such a standard module, Standard Noda, called on decision, this is an analogue if We would write in the language C. And here we need Enter the conditions, here in the field Condition, you can directly write input with handles, so I'm starting Write and appears Input hint, another way is just Put the cursor here here so that he blinks here and twoWaiting click here on variables, the same.

If Input is equal to we write quotes, the letters are small, See here a green checkmark appears, this means that our line is correct. For example, if I do not I will close the quotes, I have Error. I can click on it and A tinge appears here, that we have not closed the line. We need to close it, here Everyone closed the line, put it The second quotes and all Now green appears normally check, click, ok. If it is equal to letters Kito, then the program comes here, Yes, yes, Accordingly, these two points are no, why are there two of them for The convenience of visual spelling, we We can from here stretch out the line or from here, as we I like it more.

If the user I introduced incorrectly something else, or an empty line, or some other letter, then We make a transition Here, here again to this Node, pull the line here. Let's check how it works. ours launched Program, you can open, by the way, here So here is the scheme. We see an invitation Programs, enter t to zero scurry. g, yes, I introduced G, I press Enter, ok. while I am introducing some wrong symbols, we are each Once we will return to this point.

If I introduce t, Accordingly, nothing will happen, because further the program is not written us. We get to endless cycle and it spins, nothing does not do. You and you have learned to insert the conditions. Now we should Write a function under the program, which will be Calculate the weight of the container, that is, zero Our Libra. Let's go for this Create another sheet in our project, Because this our place will be used for the main program. We go here the project and Choose New Sheet, that is, new Liszt.

Press, appears We are one more such standard leaf, insert here here Such a block Event End, and here Event we need Replace with the name of our function. tara, yes, tear. Okay, let's send it In the sequential port still One message, open Groove Terminal, choose Print LN, in double Kovikov,Calculate Tara. You can in Russian Write, I'm used to writing in English. When we watch on Terminal, we will see that the program is really I moved to this calculation function Tara and that all It's normal that our program works. Come here, here where We have peripheral devices, module 711 and select here This function is the Write Tear, write down Tara.

In the field arguments I I will leave 10, this means that the function will measure weight 10 once and calculate the average value. For example, if I put 100, the program will do 100 for world worlds, this implemented inside this library. Everything, more here nothing needs, no variables is not used here. We display one more message, you can just copy Hence, Copy, Paste, Insert here, Zero, Scales Done. Okay.

So, we have The first subprogram appeared, the first The function is separate, which calculates the container, resumes Libra. Let's get back to our The main stream, and here we need Call this very The procedure for this, there is a special module, here called Subrautine Call, that is, a call under the program. We insert it here it, here you can choose a sheet, I I choose New Sheet and here Immediately substituted here Our only The subprogram that is on this sheet Here on this second sheet New Sheet, called.

And we press Okay. Greetings, request On the letters T, enter the letter t, subsequently we We will do this, of course, not In the proteus, when Let's pour our program in real Arduim, we will do This is in the terminal program, Calculates NTR, Zero Scale Done and that's it. Further program goes to our endless cycle, Because we still They didn’t write anything further. The logic of the program We need to either start working, to weigh something, or you need to calibrate Tenzo sensors, which means to calibrate. We must place on our scales are some kind of well-known weight in advance and say the program to calculate it calibration coefficients for specific sensors, Because all the sensors different and any sensor before Work needs to be calibrated.

In the general case, calibration It is carried out once and the coefficients are recorded in E-Prom, That is, in energy independent memory, and let's say If you buy scales somewhere In the store and Factory, there the calibration is produced at the factory. Println module, enter s For work or C for calibration. Input module, let's We copy it, copies here.

And we leave everything without change here. We will be again Use our variable input type string, squeeze ours The algorithm can simply be pulled here some kind of lower module. This is how it works, see.

You can like this Make it more compact. copies and Paste. and insert it here. Open and instead of t We put here a curly letter s. If the user introduced symbol s, so we continue Work where we will do the weighing of various subjects. If the user introduced some other symbol that NOT S, let's again Copy this decision block copies, Paste, Combine in this way.

The user introduces some other symbol that differs from s, then we We check it, is it He is a symbol of the letter C. We write here C. If the user introduces some other letter that not s and not C, then We go here where we have a request introduces c, then we must produce Calibration of sensors. Well, let's right away We will insert a call to the programs that We do not yet have. just an empty challenge, like a plug.

After we have Calibration will be made, This one will work a function that we still do not have which we are now We will write, we will have to return back to this stream of teams. Now let's Let's write the calibration procedure. She will have it on this second sheet. We take this one Module, drag here.

Instead of Event we write the name our function, it will be called calibration. Okay. Now we can already Here in the main sheet, register Calling a specific function. on the second sheet, on The drop -down list has already appeared Two functions. tar and kalibread.

Choose Kalibread. Okay. We go back to the second sheet and prepare our Calibration function. Calibration function We will begin with the conclusion In the port of another symbol of the line. Here we already have a block Println. Copy it, We insert and install here.

In this message we We will ask the user to place on the scales some kind of well-known weight. Put on Tenzodel item with a certain mass. Let's copy This block, insert it again, This will be the second The proposal to be sent in the port and prescribe.

and enter the weight of this item in grams. Let's move here where we have the periphery. Open UART, this UART branch and drag here block input. Again in it we We do not change anything, we leave everything by default. The user will be display weight in grams, but it will be line. Not the number.

We need to transform the line into the number. Therefore, we take here This block, appropriation block, Wipe it here here, open it now We need to add here new variable type int, then there is an integer. to add a new one variable, click here on the button New and write the name of the variable. She will be called Known Weight, that is, famous mass. here, falling out lists, you need to choose Integer, it The default is worth it Here, Integer is placed, int precisely Integer.

here in the line Assignments appointments We must do transformation. Known Weight is. This list Contains built -in functions, here Here they are written in red. There are actually a lot of them, See, the functions of transformations must choose here Here to inte, put a cursor here, So that he blinks in We click on this line twice to int. The function is substituted here. In fact, you can This is written with your hands, just Enter from the keyboard, If you already know what is here functions and how they correctly prescribed.

Click between brackets so that we have a cursor stayed there, choose ours variable input, click twice on her. should turn out such a design. and a green checkmark should appear here. everything, we did The conversion of the line into a whole number. It can There is a situation when a person something leads by accident Instead of the number, leads some letters, that is, some Incorrect symbols that cannot be right transform into the number. Then we need this function to inte, it will return zero.

respectively, We can make a check here on correctness. Let's add this block. If we have non-weight equal 0, then we go here again to output a request to the user.

Now we will do calibration itself. We open this one The module of our ADC is dragged Read Value block, then There is a value. to increase accuracy, this operation here is 10.

The library will interrupt our 10 times The sensor will calculate the averageorephmetical. In addition, to us another variable type will be required float, that is, fractional meaning, press New, add a variable, It will be called Raw Value. That is, as if raw meaning, initial value and select Here type Float. Actually everything. After this Blok will work out in the variable Raw Value We will get The weight value of our object with the famous only in units of ADC, not in grams, namely In the reports of ADC.

Now we will need Calculate the calibration coefficient. Let's add one more Assignment unit, assignment here we are You will need another variable type Float. This will be the one The coefficient we want to calculate. Add one more variable, call it scale, type Float, Okay. Here in the falling one the list we choose our variable scale.

scale will be equal with Raw Value, divided into famous weight. After that we need To somehow report the libraries, which works with our ADC, our calibration coefficient. Come here and choose Write Scale module, that is, save This is the same calibration coefficient. by default with us The calibration coefficient is unit, But we are this one We remove here and supply ours variable scale.

Okay. Let's copy here This cube Print, Print LN, open We will change it here. We will write that the calibration is made.

Calibrais Done, Scale is equal to the gap. and then we need to get out Just the meaning of our variable scale. So, probably let's Change Print LN to just Print to here after the conclusion of this our programs did not translate the lines The line is for the new. We will open, this Let's copy, select Print and insert Here are our messages. And now we will copy our Print LN.

You see, we do not have enough space. Let's transfer ours Algorithm for a new column. for this to us You will need this component. Interponnector. We need two of them. we put one here, we put another here.

We highlight this one line before and, delete it. and transfer here. The second interconnector We were automatically diminished Two number We need to change it to Number one so that they are connected among themselves. These blocks are interconnector Connected simply by number. The first is connected with The first, respectively, the second with the second and so on.

And here we are We connect this way. can be connected and, although in We are not the end of this procedure. So, here we display our variable. We click here So that we have a courier blinking in this line of arguments and display skille.

Twice, she click Appears here and we say, okay. We forgot to write down Our calibration coefficient in energy -dependent Microcontroller's memory, that is, in Eprom. so that after removing food Arduin's boards, after turning off, We have this one The calibration coefficient remained in memory. controller and we do not It was necessary every time when turned on Spend here This calibration procedure. We have an EPROM module. Here in the periphery, Let's open this branch.

We will need a block REWIND. this, that is Rewind, as you know, on tape recorders Previously, it was rewind. And here we can enter the address.

The address that will be Place some value in Eprom. Our coefficient will be Placed in EPROM with address 0, that is, From the very beginning. And now we can here At this address, write ours variable scale.

for this is the Put block. drag it here, that is, put in memory. And we write down the variable scale.

Okay, our function calibrates, ready. We can return to the main sheet of Main. But here in Setap procedure, that is, when turning on The controller we are not Added commands for reading this very memory.

A calibration The coefficient will be recorded in energy Dependent memory, but will not be read from there. Therefore, we still need Here at the end of our function Setap add commands for reading this very memory. We will have to continue Setap function in a new column.

Therefore, again Add the Interconnector block. He will be with our number 2 and one more. Turn on him number 2. We delete this here line before EN, that is, actually We are doing what we are already with You were done in calibration functions. This way.

We move this one here and connect. Ready. again take here This block REWIND or REWIND, We leave the address zero, there we have our scale and for that To read it, take the block get, that is, take We take the GET block, prescribe where to place this data, where to place this data He will read them in our variable scale. ok, after working out this block, we have SCALE variable calibration coefficient and It remains to register Its in our OTC, again Here from the module HX711 take the Right Scale block, That is, register the same calibration coefficient, Open it, delete one, We put our variable scale here. Let's probably Remove these blocks Hello MBS electronics, therefore that, well, in general, this is superfluous for ours Programs. And now let's do it the main cycle, first we need to get The value of weight, here It is the weights in grams, that is, In those units, in which we want to produce weighing, again Let's go here to the periphery Our Module of the OCP and We take the Read Unit block here, dragging it to Our program. During

Calibration We are with you Already used this block Read Value. Read Value We give out the so -called raw readings of the OTC, we have a 24-bit OTC, respectively The values ​​of our output will be from zero to deuce in 24 degree. Read Unit issues The value of weight, already transformed taking into account here This ours variable scale, that is, taking into account calibration The coefficient is already in our units, In this case, this We will have grams. If we

We want our scales They showed precisely kilograms, then during Calibrations just need to specify weight in kilograms. Then During weighing, we You will be Interpret the data that come from Read Unit procedures as kilograms, I hope this It's clear. Open this block and We need here Create another variable type Float, click here on the New, button We call the variable Weight, that is, weight and it should It is like Float, These are the requirements of the library Our OCT. The number of calls to the OTC for I read I will install 4 here. The more there will be the meaning, how it would be better accuracy, but at the same time the program will work longer, because this OTSP Measurements occur Not very fast, Quadrum as compromise. AND We will read the meaning just In the variable Weight weight. Now we need

to withdraw this weight in COMPort, GRUV Terminal, take the module print, not Println, namely Print, it displays some kind of message without Translation to a new line. Open, We write here Message, weight is equal and gap, Closure click and Separately, we display weight. Now take That's exactly the block Println with a string translation that And here we bring out our Variable Weight, that is, weight. After that we need to make a temporary delay, I want The scales made me one dimension in one second. Let's add here This block is temporary delays and add here 0 to be 1 second or 1000 ms. So, well You can still do something You can add at the end of the gram, so that we know that This is a gram. Therefore, let's

Replace this block with Print, not on Println, but on Print, This variable Let's copy, choose Print here, Put ours back variable weight, now add precisely Println s translation of the line with whichE through gap add the letter G. Here are our friends with You turned out Two sheets program, here We have additional Functions for programs and on The main sheet with us The program itself. In principle, everything is ready, we can Check how it works, Launch in Simulation. Let's go here to the circuit tab, Capture schematic, I have a sensor Killed, see on The sensor is initially weight 0 now, I I launch the program and terminal to us Offers news The letter T to reset Libra. Introduce T, that's it The program has worked out, now we must lead the letter C, To calibrate the sensor.

Enter the letter C, The program tells us, please Put the known weight on the scales and then print This weight here in terminal. Suppose I have weight at 3 kilogram, I put it on the scales, Let's enter 3 here kilogram, it is equal to that in real Libra I would put the weight on These scales. Here we are It is necessary not to lead 3, but 3 thousand, Because we We want us to be weighing later displayed in grams, If I wanted to have The weight was displayed in kilograms, I I would have to lead the three here, 3 thousand grams. Here is our under The calibration program worked out, See, calibration coefficient 36 with us and each Weighing cycle The program takes us weight 3000 gram, that is, we have Everything works, I can try here change this way weight. Now 10 She shows a kilogram,

Here you can see There is even some error even During the simulation. Now we can connect the computer of Arduino, already real Iron board and pour In it is our program. But before I want to make small changes in scheme, because in my already collected scales of the module CP is connected another Pin of Arduino board And I don't want them switch and at the same time I will show you how to do it. When we are here in visual

Add editor Modules peripherals, they are simultaneously are added here on the diagram and all connections produced without Drawing conductors simply Through these terminals. These terminals are needed in order not to To clutter the scheme with conductors, lines, you can simply connect by names compounds. In real mAkete Libra Exit data I have connected to Pina 4 Arduino fees, so twice Click on this terminal. Here you need to remove Fit Lock to Unlock the pins connection Change at 4, and the conclusion I have a clock signal from the CP connected to the fifth Arduino leg. Again twice

Click, remove The box of the elbow and switch to IO5. That's all. No You need to change anything here, everything will pick up automatically during compilation. Let's launch our project. I went again compilation and we have everything It started, everything worked. Let's

check, we are talking about now we can Download our sketch in Arduino fee and check how It will work In the real world. I have There is here Such kitchen scales, something weigh to calibrate our homemade scales. These scales are certainly not very accurate, But we are definitely not required now. And the CPU, the red wire is given, and the CPU, and The blue wire is a clock signal. Here at We are connected Arduino dress, respectively, Red wire We have data hanging on the fourth Pina, and the blue wire On the fifth. Let's connect to the computer, Connected, put here this Platform, on itself The case is a cutting board, purchased in store. The main thing is that she has even

surface. AND Now we will pour in the Arduino payment Our visual sketch. You see here the project, at I am on this The computer here, by the way, is writing down This video. For We will use calibration Here is such a cool one iron. Let's know,

964 grams, almost kilogram. Remember this weight. In the dispatch We'll see the devices. We have Port number appeared 5, lump 5 is just that port on which our Arduino fee. We go to the menu project, select Project Settings. Here is The programmer parameter, That is a programmer. Need, To be here Selected AVR Dude, interface Arduino from Mega 328. And Most importantly, here is the port,

See me here For some reason, there is 2, on In fact, it is necessary Choose this port on which You have Arduino fee, lump 5. Check speed. For this Arduino fees should be be 115 200. Now Everything is ready to Sake ours The program in the Arduino fee. For this just click here on this The microcircuit icon. Here the hint pops up upLoad,

That is, load in fee. That is, in fact We do not need We were even on the computer Arduino environment, Arduino and De. Everything is already in Proteus. We can Create a program here, an algorithm, check it for simulations and load it in real fee Arduino. Do everything in one environment in Proteus, despite All the disadvantages of Proteus and here this visual environment Programming, on the very The case is huge The advantage is that we are all We do in one program, we do not need anything else.

Let's click. Our code is re -compiled and After the end Compilation will begin the firmware. Here he is writes what he downloads. Here we have an inscription

mold, upload Complete. That is, our program Successfully loaded to the Arduino fee. connected to the board Arduino can be through any program terminal, for example, through such Universal program. Let's try to connect to Dress through her. Choose here our COM5, speed We have 9600 and click Connect. A message appeared

from the board. See To zero scales, let's Sile t. Here from here Click SEND and program Rucked the scales. Especially for working with these I wrote weights Small application terminal. Here This is exactly the same Choose COM5 here we connect and the same Most message Input t for zero scales. We can dial here t, that is,

All these symbols, which are used in us in program on Arduino. To accelerate the work I did under them Separate buttons letters t, letters C and letters s. Place to print keyboard letters t Here we can just Press the button. Here for zeroing weights. This The button serves for Logo window cleaning. Cleared,

by clicking on this button, you can restart Arduino fee and Reconnect to her. Click, connected by sports And you can do it how much times. Let's We will connect once again to our Libra in Arduino. Input t for zero scales. We have

there is nothing but here this fonier, cutting boards. Obviously, this board has some weight. Therefore, we reset Our scales, send letters kuta, just click on this button in my program. Now we need to do Calibration of our sensors. Choose in Calibration program Press this button. Now

We put in ours Bolvanka on the scales. Remember, that she weighs with us 964 grams. Accordingly, here we are prescribing number 964. And we send ours dresses. Press the button SEND. Here the process has begun measurements. Caliber coefficient minus 274.9. Here The calibration coefficient with

four sensors. Because for each sensor A quarter of the weight of this blank. Let's look for different things. We remove a blank and somewhere around zero 0.37 grams. This is within The errors of these sensors. Put again

Bolvanka. 963 somewhere So shows. Well, our scales not exactly business. Because everything is here So moves. Accuracy is not important to us now. For We are the main principle now. That's how much, For example, our weighs camera. Here is such Sony. Somewhere 234 Grams weighs the camera Sony. How much the battery weighs

from that camera Which is being removed now? 65 grams. This weighs battery. This design is not very accurate. She's just like would be made on the knee. Therefore We often go somewhere, floats away zero. Look, I'm rebooting Arduino now. I drive T for Khuls of Libra. We are already once made calibration these sensors. Calibration

The coefficient is recorded in Energy -dependent memory boards. Therefore, the second time is already possible No calibration do. We can immediately go to work, to weighing. Press this button

or send here From the terminal letter S and y We are a program starts to work and correctly weigh our weight. See, everything is clear. 963.5 shows. There is somewhere accuracy at the level of kitchen weights It turned out with us. Here These kitchen scales are white. They

also weighed like that. Plus minus 1-2 grams. Looking, How do you put it again So if you put it a little differently 961. If you put it like this, there is something, yes, there will be 966 Show, well, it's normal. For such weights, made on the knee From some pieces of wood is normal. The essence of that I am a second time already

There is no need to make calibration of sensors. The program took Caliber coefficient from E-Prom, from energy -dependent memory and continues work normally. That's all. Write your Comments, put Your likes. Subscribe 972 00:55:55,039 --> 00:55:58,059 on the channel, also on Our telegram channel. All links You will find in Description. In the next video on this We will expand the topic Our project of Libra. I'll tell you

How to use 4 boards about CP One for each sensor and why is it necessary.

2025-03-08 15:02

Show Video

Other news

What Grok 3 Says About Google’s Quantum Chip Will Leave You Speechless! 2025-03-14 23:55
China JUST Released NEW AI Glasses That SHOCK The US 2025-03-09 22:49
Stanford Seminar - Personal Assistive Technology 2025-03-07 20:43