Wednesday, December 4, 2013

Final Project Process 4 - Rangefinder mess & sort of success

After almost two weeks of fiddling with the rangefinders and the wave shield before and after the Thanksgiving break, trying to make one work with the other and sometimes just trying to get the rangefinders to work, WE GOT IT! ....sort of. The rangefinder now works with the wave shield, so a message plays when it gets below a certain measurement. In our code, we set it to be less than 15 inches so it would play with any trip under that amount. The problem is that it only plays when your hand is moved away from the sensor. Put your hand over the sensor and it becomes stuck, rummaging through the same play sequence over and over and over again in an extremely fast pace that you can't hear. With Katerie's awesome help, we tried multiple things to try and kick the loop out while the message is being played such as various delays, booleans, etc. Nothing seemed to really work the way we wanted it to. We'll continue to work on this and try to find a way to stop or pause the rangefinder so the message can play in its entirety.

Look at our pretty code...












Other Thoughts

We will probably need to use a buzzer or an LCD screen to give some other kind of notification for entrance. If it is a piezo buzzer, it will sound if the person is not allowed to enter based on what card they put up to the reader. If it is the LCD screen, it will state "Welcome!" or "Do Not Enter." Something like that.

First thing's first, got to make that delay happen. As of right now, the servo opens and then closes right away when the reader reads the correct card. That is not enough time for someone to enter the door. We need a solution for that.

Tried setting different delays, but changing the delay as the code is just makes the rotation slowwww. Instead, I will try what Dragan suggested: Make two separate "if" statements instead of combining them. A delay will go in between the two so that it will be delay and then "if angle = 180 { " and rotate backward. Will update later on how that goes.


Much Success!

At last, it works! After speaking to Lindsey about how here and Anya got their project to work.. I got ours to work! They used the babelfish example from adafruit http://learn.adafruit.com/babel-fish/programming. This code example uses the wave shield, however. Our project does not need that. I went in and removed everything from the code that had to do with the wave shield and got the reader to work. After that, I used the "if" to say that if a certain card with a particular UID is read, then it will open the lock. This is how we will program all of the cards depending on who it is.

The other issue I figured out with Lindsey was that we needed to cut the wire between IRQ and 2 and then solder IRQ to pin 6. That worked! I soldered a new nfc/rfid shield with the pins on top so that it could be plugged into the arduino on the bottom and then there would be open pins to plug the servo into the pins on the top. The servo doesn't use many wires, so that is good.

Besides that, we will be working on making this thing look like "art." The lock! That needs to look like a lock of sorts. Probably going to use some kind of latch, though it would be cool to have that entry bar that comes down over cars at the gate (not sure the servo motor could handle all that).


Wires everywhere!

And troubles. The nfc/rfid example code is used for a reader. HOWEVER! This code spits out hex in the serial monitor which cannot be plugged into the code at all. So.. it is pretty much useless.

We also tried to get the wires down to a lot less. This worked while it was plugged in and we were testing it out. Then... when we tried to plug it in again, NOTHIN! It didn't work. Below is the setup. Did a lot of looking around and struggled. Had to do the wiring all over again the way we had it. Got the wiring to look a bit more organized though.


Got the reader to work!!

The other day...

It actually proved to be a wiring mess because we had to make sure we could have room on the arduino for the servo motor as well! The instructions for soldering made it so that the nfc/rfid shield sits directly into the arduino.


Sketches and design outlines





I laid out my designs on paper, figuring what everything needs to work. Right now I have 6 bug ideas of varying complexity, plus the "leftovers" that can populate the space so it doesn't look empty. I plan on being in the woodshop to do these alterations tomorrow and Friday. I can't go now because I have sandals on. They get really mad at you for that.