Thursday, January 14, 2016

Final Project

The Challenge

For our final project we were allowed to pick between two options for the final. One of these options was to build an autonomous robot that could roam around the room without crashing into anything. The other option was to create a countdown clock using two 7-segment led displays to countdown from 99 to zero. This was the project that my group decided to work on. To our favor the project was a success and the counter successfully counts down from 99 to 00. The catch for this project was that an Arduino does not have enough pins to power two led displays. There are many solutions to this and many other groups just used two arduinos and tried to sync them up manually as best as they could. Our group didn't choose this option because we wanted the counter to be timed perfectly. Unfortunately the other option is to use 2 shift registers which are probably to most confusing thing that you can find in robotics. However we worked through all the problems of figuring out how these shift registers work and finally have a working design.

The Code

https://docs.google.com/document/d/140Ip2d9b16KwwrtQMW2rLL7gNifYij56FjnmomPC-o4/edit?usp=sharing

Code Snippets

int numberone = 72;
int numbertwo = 61;
int numberthree = 109;
int numberfour = 75;
int numberfive = 103;
int numbersix = 119;
int numberseven = 76;
int numbereight = 127;
int numbernine = 79;

int numberzero = 126;

This part of the code shows the decimal values for each number that can be displayed on the 7-segment led displays. This was a challenge because first we had to figure out the binary value for each configuration. Then we had to convert the binary value to a decimal value by hand. This conversion involves a lot of math and a lot of time.

int writenumber(int first,int second){
  digitalWrite(LATCH,LOW);
  shiftOut(DATA,CLOCK,MSBFIRST,first);
  shiftOut(DATA,CLOCK,MSBFIRST,second);

  digitalWrite(LATCH,HIGH);

This piece of code shows the writenumber function that we built specifically for outputting numbers to the 7-segment led display. This function takes our two numbers that we want outputted and converts them to decimal values then binary values and outputs them to the shift register. Finally it will trigger the shift register to output the individual binary values to the led displays.

Future

Unfortunately this is the last project that I will be working on as a part of the robotics class. However that will not stop my future dabbling in the wonderful world of logic and science that is robotics.

Photos


The Clock

https://gfycat.com/DefiniteCloudyHoverfly
Gif of counter functioning (note this is the counter counting up, normally it would count down)

No comments:

Post a Comment