Here is a schematic diagram of the robot. You can change the connections but make sure to change the code with it. The parts. Sensors I would like to explain "The Ultrasonic sensor" An Ultrasonic sensor is a device that can measure the distance to an object by using sound waves.
|Published (Last):||13 April 2017|
|PDF File Size:||13.85 Mb|
|ePub File Size:||17.80 Mb|
|Price:||Free* [*Free Regsitration Required]|
Two Distance Sensors I used an infra red sensor 2. Putting the hardware together 2. One huge advantage is its size. As its name suggests, the Teenst is small and compact, which is great! We start by placing the Teensy on top of some header pins, and then soldering the header pins onto the Teensy, and then mounting it firmly onto our breadboard.
By circuit convention, we can call this Vcc2. Problem is that with devices such as motors that can draw large varying amounts of current, this causes the supply voltage to dip. This is why we need a voltage regulator to supply that stable 5V to your other electronic components. A microcontroller may seem complicated at the beginning, but to get started, its really not that hard. Here are the basics: Simple, but very important.
Different microcontrollers have different logic levels, but most microcontrollers have logic level of either 3. For instance, the Arduino is a microcontroller with a logic level of 5V. It is a digital signal which is high for a certain percentage of time and low for another percentage of time. This is known as the duty cycle. Learn more about PWM here. In the case of the Arduino, its 0 — 5V. They can read it with varying degrees of resolution, depending on how many bit Analog to Digital Converter is used.
An interrupt is very cool. When a pin is configured as an interrupt pin, it detects either 1 A rising signal edge 2 A falling signal edge or 3 A change in logic level. Either of these will trigger what we call an interrupt service routine ISR.
The ISR is a short function in code that is triggered whenever an interrupt is detected. In this case, we are using the brushed DC motor. It is named as such because there is a commutator DC brush inside of it that helps it to turn properly when given a voltage.
Motors generally draw a large current and all motors have a certain voltage power rating. When motors turn, they produce a back-emf. This may sound counter-intuitive, but a motor that is turning at its maximum speed actually draws the least amount of current due to the back emf.
On the contrary, a motor that is stalled i. This is because your microcontroller cannot supply enough voltage or current to drive a motor. In addition, when motors spin, the back-emf generated could easily damage your microcontroller. What it does is that it turns on a digital switch from your battery to your motor extremely quickly. Like for instance, some encoders detect how many times a wheel has spun, others are even more accurate as to tell you exactly what angle a robot arm has turned etc.
For the Micromouse, we are using encoders that detect how many times a wheel has turned. There are hall effect encoders, or optical encoders. Two types of encoders, but basically do the same thing. They trigger a digital pulse whenever a wheel has turned! How a hall effect encoder works is that there is a small permanent magnet inside of something that is attached to the motor shaft. When the motor turns, the magnet turns as well. There are sensors that detect when the magnet has passed.
When it does, it sends out a pulse that can be read by a microcontroller. What it does is that it shoots out an infra red signal and waits for that signal to bounce back to determine how far the object is away from it. You can experiment, but if you deflect the signal off a slanted surface, you may not get a reading off your IR sensor.
This makes it not so ideal. This IR sensor also has a limited range which it can detect distances. For this particular IR sensor, depending on how far the IR sensor senses your object, it gives out a different analog voltage. What you can do is to read that analog voltage using a micro-controller. Note I did not specify exactly which pins to connect the wires to. That way, whenever a signal is sent, the microcontroller can know that the wheel has turned 1 round. Signals being fed into the motor controller should be coming out from a PWM Pin.
There are two wheels, with two motors on each wheel. If both wheels turn at the same speed, the mouse goes straight. If the left wheel speeds up while the right wheel slows down, the mouse turns right. This is known as differential control. How do we get it to move inside the maze without crashing into a wall? We might think we are sending two equal signals to the left and right motors to tell the mouse to go straight.
So the mouse should go straight right? Various reasons can cause the motors to not respond in the way we tell it to. Fundamentally, each motor is built almost the same, but not exactly the same. Hardware is never built perfectly and there is always some finite error. How do we make sure that the mouse actually is moving in the direction we tell it to?
We need what is called closed loop control. Meaning that we hook up sensors to measure the output and then feed the result back into the input to perform error correction. More on that later. In this case, we might want to get the mouse to maintain a strict distance from the wall. Say, 5cm away from the wall on its right. We call this the set-point. Any deviation from the set-point is what we call error. When an error is detected, we want the mouse to correct itself.
When the error is large, we want a large correcting action. When the error is small, we want a small correcting action. Sensors on the side of the mouse determine the distance the mouse is from a wall. Say the mouse is too far away from the wall on its right.
We want the left wheel to turn faster, while the right wheel turns slower so that the mouse can move towards the right in order to correct the error. If the mouse is very far from the 5cm set-point, like 10cm away from the wall, we want the left wheel to turn very fast, while the right-wheel to slow down by alot. If the mouse is only 6cm away from the wall, we want the left wheel to increase in speed, and the right-wheel to decrease its speed, but only very slightly.
Arduino | Maze Solving Robot (MicroMouse) \ Wall Following Robot
Maze Solver With Arduino and ArduMoto(Micromouse) V:1.2
How to build a Micromouse