Professor: Marcela Godoy
Project: Swing Winnie the Pooh
When you are passing and do not notice Winnie, it will swing happily, the LEDs will blink and the buzzer will play Ode To Joy. But when you stop your pace and come near Winnie, it will stop as if it is willing to listen and communicate with you.
- 1 * Breadboard
- 1 * Arduino Uno
- 1 * Distance Sensor (100~550cm)
- 3 * LEDs
- 1 * RGB LED
- 4 * 220 ohm Resistors
- 1 * Buzzer
- 1 * Micro Servo
- Jumper Cables (M/M)
- Jumper Cables (F/M)
- Components from LEGO and x-RCV Robot
- A Winnie the Pooh
- A box
Fist of all, I made five small tests to make sure that every small function could work well.
Test 1: How to free the LEDs from the breadboard?
The first problem I have thought about was how to free the LEDs from the breadboard because I would like to set them around Winnie. My first solution was to using tape to connect LEDs with cables. But soon I found F/M cables in the kit, which met my demand perfectly. I used the example blink code to test whether F/M cables could work and I succeeded.
Test 2: How to use RGB LED?
When I found the F/M cables, I also noticed RGB LED. There was an instruction card of RGB LED in the kit so I learned how to build its circuit. Then I modified the basic blink code (add more outputs) and uploaded it. The RGB LED worked successfully and I decided to use it in this project.
Test 3: How to make Winnie swing?
Since the toy contained a swing, what I needed to do was just to make it act. At first, I wanted to use motor and fan because I have done an interactive fan in recitation 3. However, the fan was so small to create enough wind. I used paper and paperboard to enlarge the flabellum. But it still failed to blow Winnie to swing. Then I changed my idea and used micro servo instead of motor and fan. At this time, my task was to create a mechanical arm. There was no component in the kit to make a mechanical arm so I searched suitable components at home. In the end, I found components from a set of LEGO and the kit of x-RCV Robot (I learned to play it when I was in junior middle school). I built up the mechanical arm and uploaded the example code of servo to it. The mechanical arm worked well.
Test 4: How to change the sounds of the buzzer?
I wanted to use buzzer but I thought its sound was too simple and boring. So I searched online about how to change its sounds. I found an instruction in an arduino forum and I followed it to change the buzzer’s sound into Ode To Joy. (http://www.cnblogs.com/xiaowuyi)
Test 5: How to use the Distance Sensor that I have borrowed from IMA studio?
I wanted to use the distance sensor to detect whether people came near the Winnie. Although I have not used this sensor in the recitation before, I considered it was similar to the one I have used. So I clicked the link that the page of recitation 3 contained. I found the instruction of this 100~550cm distance sensor and read it. The circuit was easy to connect but coding needed more time. I used the code that the instruction provided at first. What was new to me in this process was how to add a new file to the library. I downloaded a ZIP file and found the way to add it to the arduino library. Although the code worked successfully, I thought it was too complicated. So I decided to use the sensor code that I have used in recitation 3 at last. Also, since the distance sensor that I used initially could not work well, I changed another distance sensor when I was back to school.
Circuit and code:
After five tests, I could build up the whole circuit and write a complete code now. For the circuit part, I simply designed a parallel circuit, in which all LEDs were connected in series in a small circuit. There was no mistake in circuit part. For the code part, I initially just used “if-else” structure and put all codes that I have tested before into a whole. However, due to the “if-else” structure, all small components worked one by one but not at the same time. So I searched online to find solutions. I learned that to make different components worked simultaneously, I should use “scoop” and deliver each component’s code into a separate function. So I added “scoop” to the library and wrote a new code. The circuit worked successfully at this time.
Afterwards, it was time to make the scene. I used a box as material. Firstly, I curved one side of the box and created a hole for Winnie to swing. Then I printed several pictures to decorate the white paperboard. Then I fixed Winnie to a fit position. Lastly, I chose the best positions for each component (mechanical arm and LEDs) and fixed them. This step was not very easy because the length of wires set limits to how far could the components be away from the breadboard.
After fixed all components, I started testing. The biggest problem was that the sensor was not sensitive so the whole project could not work as ideally as I imagined. Another problem was that the mechanical arm could not make Winnie swing with wide-angles. I modified the code but the effect was not obvious. However, besides these two problems, the pet trick was successful and realized my initial design.
The mechanical arm, the buzzer and the LEDs could all work well when the distance sensor also worked. So the Winnie would swing when people pass by but stop when people come near. In this project, I have autonomously learned many new knowledge as mentioned above, like adding a new library, using RGB LED, changing the sound of buzzer, using “scoop” and so on. Meanwhile, I also learned how to solve the problems. I met many big and small problems in this process. I solved them because I tried hard to find solutions every time. Internet is a great tool to find out solutions. And I believe that the attitude of working hard to solve the problems is most important.
If I can optimize this project in the future, I would like to change a better distance sensor even though I have used two different sensors. Besides, I also want to redesign the mechanical arm since it is not working very well now. When I showed this project to the professor and fellows, they gave me some advice for the second problem. They suggested me putting a bigger servo above the Winnie and connecting the swing to the servo directly. Another suggestion was that I could combine Winnie with the mechanical arm so they could move together. I think these suggestions are all very practical and I will do better next time.