Week 12 Journal Entry – Hell Bunny – Circuit Test 1

My first task for this week was to find a Standard SD card for the Wave Shield. It was harder than I thought it would be, since all SD cards are now SDHC or higher. I went to B&H and asked in different departments. Everyone there was surprised that I’m looking for an old 2Gb card and was trying to convince me to buy at least 4 or 8Gb SDHC (“They are much better!”. Finally, a guy from the photography department told me that he might have a used one. He checked in the computer, and… it was there!!! An old Nikon Standard SD card for $2!!! I can’t tell how happy I was.

I went home and checked the parameters – it was already formatted for FAT16, so I just dragged all my files in there and put the card  into the slot on the Wave Shield. Then I decided to test Shaun’s code. I hooked up the IR to the shield, compiled the sketch and uploaded it. And… it wash’t working properly. The shield was playing sounds randomly, but just by itself, without any participation of the IR sensor. Also, when I’m testing IR sensor (I fixed the wires by soldering jumpers to each of them), I’m getting strange readings, not related to the actual situation. No matter how close or far from the sensor I am, it continuously outputs almost the same loop of data readings, starting from 0 and going up to approximately 400.

Later this week I decided to change focus a little bit and tried to control two servos simultaneously. I found a very nice sketch here and tested it in the computer lab:

Then I decided to integrate this sketch into the one that I already had, and got the following error:

/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Servo/Servo.cpp:104: multiple definition of `__vector_11′

After googling this problem, I found out that the standard Servo.h library is incompatible with the Wave Shield libraries, because they are using the same timer (Timer 1). Luckily for me, Michael Margolis has written a very nice ServoTimer2 library, that solves this problem by using Timer 2 instead of 1.

Also, because I’ve never got an adequate reading from the IR sensor, I decided to try another kind and bought PIR motion sensor from Adafruit. After testing I’ve immediately got positive results, which made me very happy again.

After messing two more days with the code, I decided to assemble the entire circuit and test it for the first time. I had two different versions of the sketch, so I wanted to test both. This is what I had on my breadboard and Arduino (sorry, Fritzing doesn’t have a symbol for Waveshield, so I used a regular Arduino, as well as a different sensor symbol instead of PIR):



Sketch 1 Test (not too impressive:)):

Sketch 2 Test (much better, but servo is not working and LEDs are not synchronized):

Sketch 2 finally gave me something similar to what I want: now I am able to control Wave Shield using PIR motion sensor, and sounds are playing randomly (I’ve abandoned the idea of using “Omen” soundtrack, because its songs are too long, which is annoying. I’m using some scary short sounds instead).

The goal for the next week is to integrate two servo motors into the sketch, using ServoTimer2 library, and then add two LEDs and synchronize them with all the other components.




This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Week 12 Journal Entry – Hell Bunny – Circuit Test 1

  1. Frank Mason says:

    Great job! But as for the servo motors code, I have been working on something for it myself. It should be done within the next few days but I just have to test it with the IR Proximity Sensors to make sure that it works. Then I’ll find a way in which we can attach the motors to something else that can make up the room in the ears.

  2. Yaro says:

    Great Frank! Hopefully, we’re gonna be able to finish the software part of the project this week!

Leave a Reply