Friday, February 16, 2024

Sensors and actuators

 


For this task, we added a servo motor into an Arduino. a servo motor is a rotary or linear actuator that allows for precise control of angular or linear position, velocity, and acceleration in a mechanical system.

To create the image above the things we need are 

- Arduino uno 

- USB Lead

- 3 Breadboard Jumper Wires

- Servo motor SG 90 


Servo motor has its own code which can be found in the Arduino application in file > Examples  > Servo > Sweep. Before plugging everything in we needed to find an example from the internet of which wires from the servo motor needs to be connected to the Arduino 

Wire 1 brown needs to be connected to the ground 

Wire 2 Red to the 5v 

Wire 3 to the PWM signal



 Sweep code 

as you can see this code is a loop starting from 0 to 180 and then goes back to 0. It will repeatedly do that and wont stop.  







 ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic sound waves. An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back information about an object promixty. 

The code for this is not included  in the example files so I have to install a new library. So go on sketch > include libraries  >manage libraries to download NewPing. 









This is what the sensor would be looking like if we have something in front of it i have used my hand for this example. 



No comments:

Post a Comment

recommender systems live coding

  Recommender system  A recommendation system is a type of AI algorithm often linked with machine learning, designed to analyze large amount...