Project - Splendabot
As a budding engineer who is interested in both electronics and coding, a robot was an obvious summer project for me to take on. The aim for the robot was to be able to move using two motors connected to an h-bridge circuit, display outputs through some sort of display and to accept some sort of input (ie buttons).
Parts
An arduino was an obvious choice for a micro-controller since I am already learning c++ and the arduino interface is easy to code for and has a wide range of options for all sorts of jobs. I chose to use the arduino Nano, paired with a breakout board to make connections less confusing and more elegant.
The motor circuity was an h-bridge control board that is often used with arduino known as the L298N, again I picked one up very cheap and if you would like to see the model in more detail take a look here. (https://www.youtube.com/watch?v=1Q0ZwpycbzY)
For the output I used the beloved Nokia 5110 display. They are cheap, readily available and have a great library from Adafruit to help a whole load when it comes to the coding. I snatched one up for around £1. If you would like more information on how the nokia 5110 interfaces with arduino, using the adafruit library take a look here. (https://www.youtube.com/watch?v=M9XBFomX7JI)
The frame is built from meccano. I chose this because I have plenty of practice with it from my childhood years and it was already lying around my house.
The motor assembly is from an old remote control vehicle of some sort. It was chosen since the gears and everything were all in place for me and fixing it to the meccano frame was relatively easy.
To act as an input signal I just created a harness of four pushbuttons (scavenged from a broken digital photo frame) and resistors, arranged in such a way that each would send a separate signal to the arduino.
Code
When all the parts arrived I started having fun with the sketch interface for ardunio (this is my first arduino adventure, and my first programming adventure away from following internet tutorials) I had a lot to learn so I made sure i was comfortable with coding for all the parts separately before putting everything together.
For example this is a sample of me getting to grips with the nokia 5110.
Understanding the button inputs was much easier. Here is my piece of code which just evaluates a Boolean statement based on the read value of the "button state".
Final code
The code which I produced is nothing too special and if I had more time I would put all the function definitions in a separate included file however this project was as much about the hardware too and I'm proud my first adventure with robotics has been such a success.
Regardless, the arduino code can be downloaded and examined by anyone here.
Thank you for your time in reading this and until next time.
No comments:
Post a Comment