Mr Octopussy
Mr Octopussy Release status: unknown [box doku] | |
---|---|
Description | Mr Octopussy |
Author(s) | Paul Adams |
Hello Shanghai Talk Readers, i hope you want to try this out yourself, feel free to contact me.
This project was done simply to show Edward Jiang and Sunny Sun Jr. that they were not the only ones that could shrink stuff.. i must admit, they are going much smaller than me at 0605!! at that size i can barely see the components but i might just try it one day. also i wanted to play around with programming a micro-controller with Arduino instead of learning CPP and programming it that way, the only drawback to using the AtTiny-arduino way is that Arduino bootloader/functions itself takes up a lot of space (1.356k of space to be precise) which makes it impractical for smaller MCU's such as the attiny13 with 1k of storage. The benefit is a comfortable Arduino environment where you can get setup and running in minutes not hours and you can prototype directly on an Arduino board and take that code to another MCU within minutes.
<videoflash type="youku">XNDQ5MjA4ODU2</videoflash>
Link on youtube.com Link on youku.com
The Schema
the only difference is i could only use 3v in fritzing, it should be 3.7v LiPo Battery
3D printing
The only thing you need to do is either find a toy or thing you want to hookup or print on the 3D printer, luckily i borrowed the Octopus from Valentin Gauffre and never returnt it.. until Mr Octopussy was alive!
Mill it out
i used our Drill presses and cnc to drill out the middle, i rushed this and almost injured myself - luckily i was fast as a ninja! if i were to do it again, i'd clamp him down to drill the guts out, it was printed with a honeycomb filling to make it easier, a hollow print would have been better.
Soldering
I used a cutoff PCB i found laying on the bench only because of the following:
1. i wanted to be able to remove the AtTing85 to upgrade the program 2. magnet wire is a tough one to solder since it sticks to nothing, basically thread it through the hole before soldering :D
this was a tricky soldering job due to magnet wires on the LEDS, if the temperature is too high it will melt the thin plastic cover half a cm away from the solder point, also i needed to remember to put on some Heat Shrink tubing. but in the end i ended up with what i like to call SoC "stuff on a chip".
Finally
Charge the battery up (regulated power supply set to 4.3v), mine was 3.7v ~40maH which could deliver up to 250mA of current, at least that's what it used up to charge. it lasts about 4 hours due to my lack of any power saving modes. Do not apply more than 5v to this circuit as there is no power regulation on it, it should be able to run as low as 1.2v but LiPo batteries have a cutoff to prevent complete discharge as they have a tiny controller built into them that needs power to charge.
Code
The following code is for the AtTiny85 to be programmed via Arduino. You must install the Arduino-Tiny library, this allows you to compile and program inside Arduino software you can use your arduino as an ISP (in system programmer) to put the code onto the AtTiny MCU and thats it. i Used my STk500 with HVSP setup only because i didn't want to plug a few wires into a breadboard. it literally is that simple, i can help you to build the same.
/* Must have http://code.google.com/p/arduino-tiny/ installed to compile for attiny85 on arduino */ /* ---- PB5 -| T |- VCC PB3 -| I |- PB2 PB4 -| N8 |- PB1 GND -| Y5 |- PB0 ---- */ //setup the pins below, we'll use 3 pins and a holder for the LDR/light dependent resistor unsigned int ledPin1 = 1; //PB1 unsigned int ledPin2 =0; //PB0 unsigned int ldr = A2; //PB3 unsigned int ldrvalue = 0; //the setup code that gets run first void setup() { pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); analogReference(0); //this took a long time to figure out! pinMode(ldr, INPUT); } /* a function to read the LDR and since it's going to provide a response between 0 and 1023 i just divide by 100 to get a grouping of numbers 0-10 to be precise.. dont divide by zero.. but who cares.. it'll just overflow or reset :D it's not mission critical */ void readLDR() { unsigned int i = analogRead(ldr) / 100 ; if ( ldrvalue != i ) { ldrvalue = i; for(int i = 0; i < 50; i++) { if (i % 2 == 1) { analogWrite(ledPin1, 0); analogWrite(ledPin2, 255); } else if (i % 2 == 0) { analogWrite(ledPin1, 255); analogWrite(ledPin2, 0); } delay(40); } analogWrite(ledPin1, 0); analogWrite(ledPin2, 0); } } /* final loop that runs all the time, we call our functions, we measure every 250ms and decide the action, every ~4seconds it'll fade the LEDS up and down. */ void loop() { readLDR(); for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=1) { analogWrite(ledPin1, fadeValue); analogWrite(ledPin2, fadeValue); delay(1); } for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=1) { analogWrite(ledPin1, fadeValue); analogWrite(ledPin2, fadeValue); delay(1); } for (unsigned int i = 0; i < 20; i++) { delay(250); readLDR(); } }
BOM
Incase you are wondering how much it costs
- 1x Octopus shell - lets say.. scavenged from Valentin's testing with the 3D printer
- 1x Attiny85 - 20rmb (i think this is what they sell for in XinCheJian.. its marked on the box)
- 1x 8pin DIP socket - stolen from Mika
- 2x 100 Ohm resistors - 0.2rmb
- 1x 1k resistor - 0.1rmb
- 1x 0.1uF capacitor - 0.1rmb
- 1x PCB - found on desk
- assorted wires - found on floor
- 1x 3.7v 40mah battery - Borrowed and not returning to EdwardRF
- 1x power plug - stolen from EdwardRF
- 1x 1.5M ohm LDR - stolen from Swarm_robots group/ALF group
- 2x blue LEDS - 0.2rmb