HowToMake(almost)
Anything

 

Software

Since I had already done a special PCB and programmed it two weeks before, I decided to catch up on some projects. I redid the PCB to a sligthly nicer version, I 3D printed a housing for my fan-agent design (see final project pitch), and laser cut the 'fans'. Next I programmed it.
Then I took the opportunity to redo my mold from last week (make it nicer), and my chair from the SomethingBig-week, -and added an ottoman and a table just for kicks!

Software (and some other stuff)

PCB (milled in modella):

Housing+gears (3D printed):


Fans (laser cut acryllic):

Program (AVRstudio)
The program sets up timer0 to drive the servo (OC0A) with 50Hz, and the IR diode(OC0B) using fast PWM. When the OCRB compare interrupt starts I read the input from the IR sensor on ADC0. After two readings I can save the value as reflected IR, after 5 as ambient light. I can then compare the two values and the get the actual distance reading. I have no use for the extra readings I get from the ADC, but this way of programming saves a timer for later purposes. Finally I take the input and scale it to the servo output. Because most of the smarts is in the interrupt, the main loop is very simple. (I.e. all flags -readIRavg/readIR/setServoFlag- is set in interrupts).

while(1)
{

if(readIRavg || readIR)
{
IRcounter = 0;
ADCSRA |= 0b01000000; // Start ADC
}
else if (setServoFlag)
{
setServo(distance/18); //Set servo with scaled value
setServoFlag = false;
}

}

Assembly:

The PCB still needed a bit of hacking to work properly, but next version will be perfect(!)... Here's a video of the current progress:

VIDEO!

Molding&Casting in chocolate!

Chair, Ottoman, & Table