Teeman esittely

Perinteinen esimerkki robotiikkaprojektista on auto, joka mittaa etäisyyttä seinään. Kun etäisyys on liian pieni, auto antaa uudenlaisia käskyjä moottoreille ja kääntyy. Tällöin robotti on ikään kuin oma itsenäisesti toimiva kokonaisuutensa, joka ei viesti muun mailman kanssa.

Joskus olisi kuitenkin hienoa vaikuttaa robotin toimintaan tietokoneen kautta tai vastaavasti vaikuttaa Arduinolla tietokoneen toimintaan jotain kautta. Tämän teeman harjoituksessa muodostetaan yhteys, jonka avulla pääset kokeilemaan graafiseen ohjelmointiin suunniteltua Processing-ympäristöä ja muuntelemaan näyttösi grafiikkaa Arduinon avulla.

Teeman ensimmäisessä projektissa ladataan Twitteristä dataa, ja tehdään muutoksia valoon tai liikkeeseen tämän datan pohjalta. Toisessa opastetaan LCD-näytön kytkemiseen ja käyttöön Arduinon avulla. Kummassakin projektissa pääset siis liittämään Arduinoon jonkinlaisen uuden rajapinnan.

Alla olevalla videolla havainnollistetaan etäisyysanturin lukemia tutka-visualisoinnilla.

How to Mechatronics: Arduino Radar Project

Tekstitykset

hello Daniel Kottke here from how to mechatronics comm in this video I will show you how you can make this cool-looking Raider using a Arduino board and the processing development environment all you need for this project is an ultrasonic sensor for detecting the objects a small obvious servo motor for rotating the sensor and an Arduino board for controlling them okay so now let's set up the components first I made a cardboard stand for connecting the ultrasonic sensor to the servo motor I fold it like this glue it and secure it to the servo motor using a screw like this also I attached a pin header on which I soldered four jumper wires for connecting the sensor finally I secured the motor to the Arduino board using an elastic band here is the circuit schematic I connected the ultrasonic sensor to the pins number 10 and 11 and serve a motor to the pin number 12 on the Arduino board now we need to make a code and upload it to the Arduino board that will enable the interaction between the Arduino and the processing development environment for understanding how the connection works click here to visit my Arduino and processing tutorial here is the Arduino code and I will just make a quick overview of the main program and on my website you can find the source code the description of each line of the code so with this for loop here we are rotating the servo motor from 15 to 165 degrees and for each degree we calculate the distance measured from the ultrasonic sensor and we send these values into the serial or which will be received in the processing development environment additionally we send some characters needed for indexing if we upload this code to the Arduino board the server motor will start rotating and if we run the serial monitor we will get some values like this first is the value of the angle then it goes the comic character then the distance value and the point character now we will receive these values in the processing development environment using the serial event function which reads the data from the serial port and we will put these values of the angle and the distance into the variables i angle and i distance these variables will be used for drawing the Raider the lines the detected objects and some of the text for drawing the Raider I made this function draw Raider which consists some arc and line functions for drawing the line that is moving along the Raider I made this function draw line it's center of rotation is set with the translate function and using the line function in which the eye angle variable is used the line is redrawn for each degree for joining the detected objects I made this draw object function it gets the distance from the ultrasonic sensor transforms it into pixels and in combination with the angle of the sensor draws the object ponder Raider for the text on the screen I made the draw text function which draws text on the particular locations on the screen all of these functions are called in the main draw function which repeats all the time and draws the screen also here I am using the fill function with two parameters for simulating blur and slow fate of the moving line you can find this source code on my website with a description of each line of the code that's all here you have your Arduino writer done thanks for watching and for more projects like this as well as tutorials visit my official website how to mechatronics calm