The slingshot emulates a USB mouse, so it really is a plug 'n' play. It translates the physical use of the slingshot in to appropriate mouse controls. With a real slingshot, you tilt the slingshot and stretch sling. The idea to measure these was using:
mbed NXP LPC1768……………………………………………………………………………………………….MMA7361L 3 axis accelerometer……………………………………………………………..Potentiometer
A mbed NXP LPC1768 -the microcontroller which does the processing stuff An mma7361l accelerometer - this can measure the tilt by tracking the gravity vector (which way is down!) A potentiometer - this can be used with the sling, and measure how much it is stretched
That is the input, but to play Angry Birds, you actually click on the bird, then drag to the launch angle and strength you want, then release. This means we have to translate the real slingshot movements in to a series of different mouse movements.
For example, this means translating starting to stretch the slingshot to a mouse to click and hold, whilst the vector of the stretch determined by the angle of sling and how far it is stretched translates to mouse movements relative to where we started. More on the maths later…
Finally got the mbed processor in our hands, pretty excited to xplore the power of this processor.
Started with the same old stuff, blinking LEDs . Successfully used the analog output to make a LED fade out and glow in. Had to stop work due to no other components.
Issued an LCD and had our connections made. Got stuck as we wern't able to compile our code to use an LCD (which we just copied from the tutoral itself ), it gave some library error(unable to import library TextLCD.h ). Finaly we came to know that importing the library to a project is a mandatory thing.
Still stuck with the same problem which just doubled itself. Now we have 2 errors..!!!!
Wasted the day gazing at the compiler and hoping it would work and reading the library “TextLCD.h” documentation to find any error we have. All in vain. But finally at around mid night accidently fixed the problem just imported another of “TextLCD.h” library and it worked. hmmmmm……so it was that library which caused the problem.
Having the code compiled we tried to connect the 16×2 LCD and use, but some problem crept in and the LCD didn't worked. All connections were correct according to the specimen on website but still we couldn't have our display working.
Another day wasted in the LCD problem . Contacted seniors but nothing worked well . After some more struggle we had to give up and end the day's work.
Left the LCD issue aside and started to establish a UART connection between the device and the computer to use the PC as our display unit. SUCCESS..!!!
We just made the connections as given in the datasheet and and used the software 'docklight' to display stuffs on the PC.
Successfully controlled the PC mouse using four buttons up, down ,left ,and right using the mouse library mouse.h functions.
Implemented the left click,right click ,double click and scroll function of mouse. Now we had a complete mouse able to perform all the functions like a general mouse.
enough for today
Two passive days went by. Not much work done.
After wasting two days,decided to take a look at the MMA7361l accelerometer. Searched on the net but didn't found anything about it. Although we did found about many other accelerometers but nothing was related to it.
The accelerometer has three pins for the x,y and z accelerations,live,ground,a 3v3 pin, a 0g pin(used to detect free fall),self test pin ,sleep pin(don't know what it is for)and g-select pin. We had no idea of how to connect these pins to the mbed.
After spending quite a good time searching for it finally we connected the x,y,z pins as normal anolog input and have the ground and live connections made. Tried to analyze the output on docklight and yes,it was showing the output coming from the x,y,z pins. But the voltage was very fluctuating and was not varying significantly upon the motion of the accelerometer. No idea of whats going on.
Still struggling with the accelerometer and its output.
Contacted our mentor and returned with some advices. Not much worked. :(
Had aur discussion session with the coordies. All agreed to replace the accelerometer. Again tried our hands on the accelerometer . All in vain. :(
Did some research on the accelerometer and we got a library for that accelerometer on the mbed website on the name of <mm7361l.h> . Connected it and it worked :) !!!
Got the angle output from the accelerometer . Looked pretty much correct.
Made a mouse controlled by the tilt of the board. Also made a contoller for NFS, working on the same principle.
Search started for the piezoelectric sensor. Contacted the SAHOO electronics to no success.
Went to SAGAR Market ,a hub for electronics but we couldn't find our thing even there. :(
With the accelerometer we had ,tried to control the mouse to play angry birds. used relative mouse concept but it didn't seemed to be working accurately. Although it feels quite good to play angry birds with it
Got the problem…..the accelerometer was giving junk values when it was getting jerks. Also the differences of vector that we were taking for the coordinates of new position of mouse was not reliable and accurate for a circle that's why the mouse was not moving smoothly in a circle.
So, we have to work with absolute mouse for more accurate and smooth motion of the mouse.
Started reading about absolute mouse,went through some sample codes and tried some of our own codes. The absolute mouse was defining its own center based on the screen resolution and then it was placing the mouse pointer to a (x,y) position.
Tried to move the mouse pointer in a circle but it was rather moving in an ellipse
Tried our old working code of angry bird but it was not working at all. The pointer was moving in any random direction.
Got this piezoelectric sensor from the club
This one is too sensitive , a considerably less force can cause the voltage to drop down to 0 and as one removes it , the voltage builds to 1. Unfit for our purpose.
Search for a new piezo sensor begins. Finally , we got ourselves with a small potentiometer which ravi came up with in gorakhpur. Hoping that would work for us when ravi returns.
Made a rough model of the catapult using pipes. Still struggling with the absoulute mouse.
Got ourselves in a big problem. A “USB Device not recognized “is displayed when one plugs in the mbed into a computer. Checked the connections via a DMM everyting was visibly correct.
Still struggling with the mbed. Made the usb connector once again and it worked. Probably the fault was with the connector. Back on track, we decided the implement all we've done till now using the absolue mouse.
Got 2 know that 1 needs tho scale the resolutions using the absolute mouse. Did that and it worked. Made the accelerometer controlled mouse once again but this time using absolute mouse. Finally made an angry birds controller , this time no shaking as absolute mouse is used, any error is automatically removed as coordinates are controlled by mbed. Enough for the day...
Time for the final evaluation….prepared for that whole day….presented our working prototype to the coordinators and the seniors
Finally got the potentiometer after so much efforts and time. thanks to Ravi . tried to understand its functioning and the way of its implementation in our circuit.
It gives anolog output according to the resistance used in it.
We used it in our prototype and made a complete and final prototype of our circuit. It worked.
Implemented the potentiometer in our circuit. just took the anolog output from it and controlled the stretch with it after some filter of the voltage. As it was giving uniform variation from 0 to 1 volt we had to use a filter.
We also made a design for our catapult. we are using PVC pipes(they are really strong )and some wood to make our structure.
Started making our catapult. Got the wood carved from a carpenter and pipes from a hardware shop.
making the slingshot with the help from robotics and aeromodelling (upto some extent) clubs.
Mounted the mbed and accelerometer inside the pipe and made the connections. Checked the working of acclerometer and found that y-axis is working more accurately than the other two.So we are gonna use the y one.
Did some coding stuff. Made our final code ready with stretch,tilt,mouse movement,filter,switches for various use and other stuffs done.
Now since our code is completely ready we are giving our full time to the hardware stuff. Mounted the potentiometer on the pipe and checked the connections and its working. Everything was perfectly fine .
Did some finishing things for the slingshot. Mounted the switches and leds for a better look of the slingshot.
Played angry birds with it. Nice working. Our wingies appreciated our work .
Probably one more day and our final product will be ready.
Finished final works on the controller. Gave it a cool look and tried to make it more easy and comfortable to use.
And finally we are playing the game with it.
Gone through the tutorials and documentation of previous years and and by the afternoon we roughly made an idea of how to make the two.
Completed the tutorials and documentation by the night. Only some more stuffs are need to be added to the tutorials. Hope to complete it finally by tomorrow.
We painted it. Its looking cool and awesome.
Made the documentation and tutorials. It was a tough and boring task but cant help it.
Time to do something cool with the camera. Recorded some shots of our slingshots. Went through all the pics during the making of our project. It was a sweet and rememberable memory all through the summer.
Assembled all the pics and arranged them in a proper order. All this wouldn't have been possible without Microsoft Movie Maker. Thank You Bill Gates.
Made the presentation on Prezi.
And that's all the from the team Technozion on USB Slingshot. Good Bye