case, we're reversing one of the wheels to make outside the brackets above will execute.
#FUNDIMENSIONS BRAIN BUGGY CODE#
When the IR sensor detects a close object, the code A4 as fast as this while loop can execute Let's put in a delay, otherwise we're reading from It is crucially important that you do not change the direction
same direction as the left and its mirrored. the right wheel because it needs to turn the The wheel direction pins are set opposite on HUB-ee datasheet and the speed output is set to The wheel direction pins are set according to the This original statement compared the pin number (0) to 'tooClose,' as long as the IR sensor input isn't higher than the The Buggy will execute the code inside the 'while' brackets Read the initial value of A4 (or whatever sharpIR is defined as): strictly necessary because the ADC is an input This stores the value read from the Sharp IR sensor be allowed to get before the HUB-ee Buggy changes This is the threshold for how close an object will Our right HUB-ee is connected to D9, D10 and D11 Our left HUB-ee is connected to D6, D7 and D8 Our Sharp IR sensor is connected to A4 Define the pins to make the code more readable Plug the Redboard into your computer, and load up this Arduino code: language:c This will be achieved by reversing one of the wheels for a few milliseconds. The HUB-ee Buggy will keep an eye out for obstacles and turn around when it gets too close to one. In this case, though, we'll keep it basic. There are a lot of really clever ways to do this, and you can make the code as complicated as you want. We need to tell it what to do when it encounters a wall or other large object. The HUB-ee Buggy is almost ready to go, but right now it doesn't have any way of avoiding obstacles. Now the head of that bolt should be touching the ground and keeping the bot upright. Now take another 4-40 bolt, put a nut on it, and screw it into the other end of the standoff. By twisting the nut and the standoff against each other you can force them to stay put on the bolt. Now put another nut on there, and snug a standoff against the nut. For the bolt on the "back" of the robot (now's a good time to decide which is the back, I chose the side without the FTDI header), add a nut, and tighten it up the the board. The standoffs aren't quite long enough to keep the bot from falling over, so we need to bolster them with a little bit of bolt length on either side. Drop one of your 1/2" 4-40 bolts through the mounting holes on two opposite corners of the Protoshield. Once you've drilled your holes and you're sure that they line up, go ahead and put the 4-40 bolts through, and connect the wheels to the Protoshield.Īt this point you'll have a pretty wobbly little platform so we'll have to add a few standoffs to keep it stable. Now take your drill (or rotary tool with a drill bit), and drill holes to mount your wheels. Thus, decided to keep it simple and pop on a AA battery holder.
Originally, I thought that the LiPo Shield might be a good solution for this, but it just couldn't drive the wheels to my satisfaction. Not only will it allow us to wire things to the Redboard, but it will also serve as a base to which we can attach the wheels.įinally, we need power to get this whole production moving. The Protoshield PCB is really nice for small projects like this which are basically built on top of a development board. The simple way to solve that problem is just to add a few stand-offs to prop it up as it scoots around. With only two wheels, the HUB-ee Buggy would tip over if there wasn't some support under it to keep it upright. This is how the HUB-ee Buggy will keep from bumping into things and getting stuck.
Reading the output is really simple with a microcontroller like the ATmega328 that has a built in ADC because it outputs a voltage. It's an infrared sensor that detects objects by shining an infrared source and detecting the reflected light. Speaking of the IR sensor, the Sharp GP2Y0A21YK is one of my favorite sensors for simple object detection and avoidance. It'll take input from the Sharp IR sensor and give output to the HUB-ee wheels. The wheels won't know where to go if there's no brain, and that's where the Redboard comes in! The Redboard is an Arduino-compatible development board based on the ATmega328 microcontroller. Without wheels and motors, this robot isn't going anywhere.
#FUNDIMENSIONS BRAIN BUGGY DRIVERS#
The wheels, motors and drivers are built into the HUB-ee wheels so it's pretty obvious what function those serve. To understand how the HUB-ee Buggy works, it's probably best to start by breaking it down one component at a time: