More IR Detector-Emitter

Ilia was away... agian. This left me with pretty much nothing to do because Ilia was doing most of the programming work before and didn't comment. I hate to admit it but I sort of need him for the programming. So... not much got done.

10101010101

We got the code working today!
It is able to successfully transmit/read bits.
It goes like this:

Read the current pulse time

The pulse duration is equal to the previous time, subtracted from the current time.

The number of bits in each wave is the pulse duration divided by 1300 (one bit).

This gives an output similar to this:

1 1 2 1 2 1 1 1 4 2

Each digit represents an edge of the wave and their values are how many bits are in each wave.

So in binary it would look like:

01001001 01000011

If you still don't get it, this should clear it up:

1 | 1 | 2   | 1 | 2   | 1 | 1 | 1 |4        | 2
0 | 1 | 00 | 1 | 00 | 1 | 0 | 1 |0000 | 11

Convert that to Ascii and you get: "I C" ( My Initials XD )

Ground

We spent half an hour today debugging the beacon circuit. It was working and then all of a sudden stopped. We hooked up the scope and found that the pulse was around 44khz and it was supposed to be at 36khz. We fixed the code but the receiver still wasn't picking it up. Then we found the problem, we accidentally reversed the  output and ground pins on the detector *facepalm* .  However, if this didn't happen we wouldn't have found the problem with the frequency. Anyway, after reprogramming the beacon, we slightly modified the input capture code that we used with the digital compass to work with the beacon detector. It doesn't really work yet though, so that's what we'll be working on tomorrow.

IR Beacon-Detector Cont.

We continued working on the IR beacon-detector. We moved our program for the beacon from our emulator on to our actual PIC so we can use the emulator to get the detector working. To do this we had to actually breadboard the beacon circuit and figure out how to use the programmer. We also had to change a lot of our code to go on the PIC we are using for the beacon because it's a different type of PIC than the one we are emulating.

Beacon Schematic

We did most of the beacon schematic today. We're going to have either 4 or 5 ir leds per beacon and I'm thinking of adding an extra regular red or green led so we can get some visual feedback from it too. There is going to be a 3 pin dip switch so we can choose preset output patterns by setting the corresponding pattern on the dip switch. This way, we won't have to reprogram the beacon's pic every time we want to change the message being pulsed out. I'm hoping to get the cirtuit breadboarded tomorow with the actual dsPic30f2012 that we will be using for the beacons.

Bitwise

We made A LOT of progress today. First we wrote a function that converts a character into it's binary value and stores it into an array. Once we got that working we had the ir beacon pulse out the binary values. Due to the way the detector works, we had to invert the signal to keep the output from cutting out. After doing this, the results were pretty consistent. We then moved on to getting it to pulse out whole strings which was surprisingly simple. The funny thing is that we only really need it to pulse out a 4 bit pattern. You could say we got a little carried away. Nevertheless, this has to be one of the coolest things we've done so far.

IR Beacon-Detector

Our IR beacon-detector parts came in today. XD. We started by writing the code for the emitter. Then we hooked up the oscilloscope to the output pin to calibrate the frequency (mostly trial and error). After we got the timing right we connected the emitter circuit to the pic and the detector to the oscilloscope on a different channel to see the relation between output and input IT WORKED FIRST TIME! We are both still in shock. Today was a good day.

Presentation Day

Other than my voice cracking every other word and me putting up a slide backwards, the presentation went pretty well. We made it simple enough (I hope) that everyone in the audience understood what we are trying to do but still technical enough to make us sound smart :p.

Presentation...

We spent the day putting finishing touches on our presentation...

Presentation Prep

We have a presentation in two days for all the other mentorship students and their parents. We decided to use a software called Inspirartion which will display our ideas in a manner that is very visual and easy to understand. We also talked about ways to present our ideas and project goals in a way that will be comprehensible to an audience without any technical background.

Almost Done...

Ilia didn`t show up today, again without telling me (btw I checked my email and Ilia didn`t email me the last time either). I don`t really blame him for not comming in; today was very boring (Ilia would have just slowed me down anyway :P). I finished drawing in the connection for all our components other than the IR detector because we haven`t bought one yet.

More Schematics

We worked on the schematic today, (btw I don`t know what Dave`s talking about becasue I`m better than him on OrCAD). Anyway, we got all the hard parts of the schematic done today. I drew up the H-Bridge circuit becasue Dave was away the day I did that. The rest will be relatively easy, just time consumming.

OrCAD

Now that the libraries are finished and we know how all the hardware will hook up to our PIC, we decided to start on the schematic. Mike helped teach me OrCAD (Ilia is useless at this stuff) to start drawing the schematic. I learned the basics by hooking the PIC up to power ground and connecting the programing and master clear lines. I think Ilia slept though most of the lesson, but now I know OrCAD well enough to work without Mike to produce the schematic.

Digital Compass Woes

The compass was still giving us trouble, so around 1:30 so we called in the experts. Another hour with an oscilloscope and we finaly figured out that we forgot to put the pull-up resistors in... agian. Nevertheless, we got it working. WOOOOOOOOOOOO!!!!!!!!

Libraries..continued

We finished organizing the code all except for the digital compass which for some reason just didn`t want to work. We`ll have to figure that out on Monday becasue we`re too tired and it`s a Friday night.

Libraries

Dave`s not here today so I thought it would be a good day to start organizing our code. Right now it`s a huge mess. It wasn`t even devided into functions and most of the variables and code was canibalized for other applications so half the original code didn`t even work. I spent the day putting everything into legible and usable functions with relivant variable names and then putting them into header files.

IR beacon (continue)

Before I begin this post, I feel that I must defend myself. First of all, I emailed dave telling him that I wans`t going to be there. The fact that he doesn`t check his emails isn`t my fault. Daves ``averaging function`` was basicaly just him rounding it from 3 to 1 decimal places. My method was WAY better. Also, the calibration functioned mentioned was 95% written by me and was my idea.

Ok, back on topic. We continued to work ok the IR emmitter-detector setup which we started the day before. No real progress was made today. It was mostly just testing out different configurations in the way the ir led and detector diode were positioned and shielded. The detector was picking up a lot of ambient Ir light and it had a very wide field of view so we used some black electrical tape to focus the detector on a specific spot. This method worked pretty well.

IR Detector-Emiter

We started experimenting with some IR leds and an IR detector diode we found in the shop. Unfortunately, the first IR detector diode got fried. My bad... We found a newer diode to use instead and got both it and the IR led working. We conected the diode through an analog pin on the PIC and had it displaying values in Hyperterminal. It worked well enough for testing but at a very limited range. We`ll need to find a higher powered IR emitter as well as a more sensitive detector for better range.

Accelerometer... Again

Ilia didn`t show up today (without telling me) so I decided to give the accecelerometer another try. I rewrote the averaging functions the way I wanted to do it. Last time Ilia forced me to do it his way which didn`t work as well. I got the accelerometer giving acurate readings to 1 decimal place with the calibration function holding it to 0.0 constantly. However, when we moved the accelerometer around to test it`s distance calculations the speed did not go back to 0 when we stopped. It`s definatly an improvement from what we had and maybe we can still incorporate it.

Digital Compass (I2C)

The I2C connection gave us a lot more trouble than we thought it would. We already had working example code to use but it took us half the day and three oscilloscopes to figure out that the compass does not have on board pull-up resistors. Once we added those, it worked. We compared the sets of readings in Hyperterminal and the I2C was much more consistent and had a higher resolution than the PWM.