Final project notes
Table of Contents
1 Unpolished
Built a board for speaking TWI/I2C by bitbanging. Used Neil's serial bus board and adapted code from the accelerometer. Board failed in mysterious ways (see networking week); decided to revisit using native TWI.
Designed a board for natively speaking TWI (using atmega328p).
- Board design
- Board had some manufacturing and design errors.
- Manufacturing errors: some pins were subtly bridged (RESET and CLK).
- Design errors: accidentally used pins that were not general-purpose I/O for some of the LEDs (most ADC pins are, but these weren't). Put placeholder 0 ohm resistors on the SCL and SDA lines, forgetting that if I needed pullup resistors, they'd need to be between the lines and Vcc, not on the lines themselves.
- Mysteriously, serial i/o produces gibberish. Will need to use oscilloscope to determine
- ! Emergent idea: Although I initially intended the LEDs to indicate status, I could also use one as an IR LED for testing the camera.
Programmed the board.
- I used Neil's hello.arduino.328p.blink code to test whether the board was programmable at all.
- I borrowed a TWI library to test whether I could communicate with the camera. I intend to define my own API functions instead.
- Initiating TWI worked once I fixed the solder bridge between reset and clk (which caused the board to reset every time the register was activated).
- Sending a hello command to the camera worked — after many hours of debugging, I discovered that it was necessary to wait around 1sec before sending the first TWI command. I suspect the camera needs time to load.
- Sending a read request to the camera worked — after a great mystery (the camera itself has very sparse, contradictory, flawed documentation written by various hobbyists), I found that you have to write a specific byte to the camera each time you want to request bytes from it.
Fixed serial (Thursday)
- I swapped which of TX and RX refered to in and out again. For reference, it's relative to the computer: Transmit is out, and Recieve is in. (To be absolutely sure, compare the board design and code for echo hello world and see which is which.)
- Adapting the echo hello world code from attiny45 produced gibberish, suggesting timing errors.
- I realized that the makefile for m328p.blink assumed a 20MHz
crystal on the mega. So I changed
F_CPU
from 20000000 to 8000000, as 8MHz is the default clock speed for the m328p's internal clock. - Finally, the default echo hello world baud rate was too high. Given that there's no crystal, we need a lower baud rate.
LED daughter boards
- Using inkscape, made a triangular array.
- Then experimented with a simpler design. You can add one or two leds (so, for example, one infrared and one visible).
Board 2.0
- Relocated all four LEDs to general i/o pins.
- Added a status LED between vcc and gnd.
- Added a 5V regulator to regulate power to the peripherals. This required one additional 0.1uF capacitor, because the datasheet recommended adding smoothing capacitors to both sides. (I already had a smoothing 1uF capacitor between unregulated power and ground, because this design is a descendant of one of Neil's.)
- Added a 20MHz resonator — I expect the camera might require fast timing. Will remove if unneeded.
Saturday 8/Dec/2018
Having milled four led daughter boards, stuffed. them.
Used phone camera to check that the infrared leds were working. Turns out they work with 100Ω resistors rather than 500Ω resistors.
Finally found documentation for the commands to send to the camera to make it activate. It works! (Todo later: simplify the code using subroutines and fundamental register commands instead of library commands.)
By inserting appropriate delays, became able to request repeated reads from the camera without it blocking.
Used Interface week's nodejs code to read from the serial output
Wrote a bit-shifter to unpack the encoded data from the camera.
Modified my synthetic-data-generating code to decode serial input and send it over web sockets (modification of Interface week's nodejs code.)
! Plotting of a single point works correctly. (Todo: test multiple points.)
Plotting of multiple points works correctly. Experimented with various ways to deal with the event-based serial data spurts. Optimization using
slice
instead of repeatedshift
.Workflow:
- Run node on
ir-serial.js
- Open a page like
dxh.plot.infrared.html
in the browser.
- Run node on
wooden glasses (all one piece with flextured hinges!)
https://www.youtube.com/watch?v=2Nj167idFkQ
- Hinged all-wood glasses https://www.instructables.com/id/Laser-cut-foldable-wooden-glasses/
Sunday 9/Dec/2018
- Made a daughter board for converting 9V battery into regulated 5V using four pin connectors.
- Projection math
Monday 10/Dec/2018
- Began designing enclosure for pcb board; sketched plan to print a back part and lasercut a viewing screen.
- Brainstorming about ways to affix board to monitor like webcam.
- Lasercut a mounting place for the pcb board
Tuesday 11/Dec/2018
- Designed and lasercut draft version of visor; further iteration awaits.
Wed 12/Dec/2018
- Surface-mounted leds
- Designed and began printing chassis
Thu 13/Dec/2018
- Battery case screw holes. Two circles spaced apart. ~32mm outer distance, ~22mm inner distance.
- Safety glasses dimensions: 38mm from leg start to hinge, 70 from hinge to leg inflection, 45mm downturn, 6mm thick legs
- Battery case dimensions: 30mm x 54.5mm
Fri 14/Dec/2018
Plan to make daughter boards with through-hole leds.
Rivet diameters 1.0mm or 0.6mm inner-diameter rivets.
~ outer diameters: 1.5mm or 0.8mm, resp.
Idea: since we're trying rivets, just print out the rivet part to confirm that it goes and to test the alignment process
- front traces:
just_holes_fcu.svg-traces
- back traces:
just_holes_fcu.svg-traces-reversed.png
- edge cuts, including 8mm holes:
just_holes_bcu-edges.png
- front traces:
Origin: [40, 50, 15]
For offsets: (1/32)" is 0.79375mm
Failed, b/c 0.8mm holes were too small for 1/32" end mill
Try again with 1mm holes.
Riveting tool has different rivet applicators based on the inner diameter (here 1mm).
Metric hex wrench
In design file, increase drill diameter by 0.1mm larger than nominal
Also, do holes first by reversing cut path
New: traces:[20, 4, 17], edges:[20, 4, 16]
Offset for tool width [20-0.79375, 4+0.79375, 16] = [19.20625, 4.79375, 16]
Hairband dimensions:
- Thickness: Squishy, somewhere between 4.6mm (uncompressed) down to <4mm (compressed).
- band width: 7.5mm
- band length: ?
https://www.3dhubs.com/knowledge-base/how-design-snap-fit-joints-3d-printing
http://fab.cba.mit.edu/classes/S62.12/people/vernelle.noel/Plastic_Snap_fit_design.pdf
http://web.mit.edu/2.75/resources/random/Snap-Fit%20Design%20Manual.pdf
https://www.slideshare.net/ankitsrivastava151/snap-fit-design-by-neeraj-kumar-jha
Sat 15/Dec/2018
Milling 4x through hole
- The image of the board is 13mm high (and 55mm wide). Adding 15mm buffer between to be safe.
- Process: Mill all traces. Mill all outlines.
- Trace 1: [10,6,18]
- Trace 2: [10,21,18]
- Trace 3: [10,36,18]
- Trace 4: [10,51,18]
- Trace Battery: [10, 66, 18]
X = 10-0.79375 = 9.20625 Y = 6+0.79375 = 6.79375 Z = 15
- What is a safe way to fixture flipped circuits?
- The infrared led works with external power. ¯\(ツ)_/¯
- Clip works
- Rivets?
- Do we have access to machineable wax?
Sun 16/Dec/2018
[X]
Finish soldering leds
[X]
Test leds to ensure operation
[X]
Design a new enclosure for the leds.
- Options include two snap pieces or one.
[X]
Laser cut a new window pane
[X]
Design battery attachment or enclosure (screws?)
- Consider straight led segments w/wires.
- Stretch: print a hexagonal camera enclosure for visual appeal.
- Stretch: redesign pcb to be half as wide (leave out the 2 resistor segment) Problem: will need to draw and mill and stuff two new double-sided boards
- Stretch: consider pure led and wire approach.
Monday 17/Dec/2018
[X]
Fix the 5V battery converter so the led lights up
[ ]
Affix bar to band
[ ]
New strategy: use double-sided clip.[ ]
First clip prototype broke before being used — remaking sturdier.[ ]
[ ]
Consult wii projection math to improve the fov calculation.
[ ]
Experiment with faster I2C rate?
[ ]
Do the writeup for the class.
[ ]
Include pictures and files and so on.
[ ]
Design an immersive environment.
[ ]
Stretch: Remove I2C library from the code and just bit-bang
[ ]
Stretch: divide the 3D environment code into usable submodules.
[ ]
Stretch: Make the code a drop-in replacement for cameras in all threejs applications.
Button cell case + molding/casting glasses-like earhook on headband seems cool-looking but superfluous, given that it will take more than that to power the bright leds well.
Make:
2 Writeup
2.1 What else exists
- Wiimote technology
- Accelerometer headtracking.
2.2 What to make
- The board for the camera. (image, schematic, traces, edges)
- The enclosure for the camera.
- The battery holder
2.3 Bill of materials
Item | # used | Source | Cost |
---|---|---|---|
Atmega328p microcontroller | 1 | Digikey | |
Superbright Infrared LEDs | Adafruit | ||
Infrared camera | Digikey | ||
? 3d printing material | |||
SMD Resistor — 1000Ω | |||
SMD Resistor — 100Ω | |||
SMD 2x02 connectors | |||
SMD 2x03 connector | |||
Ribbon cable | |||
Programmer
2.3.1 What I bought and why:
- I bought an infrared camera because I decided to use infrared headtracking.
- I bought superbright infrared LEDs to increase the distance from which I could detect a person. I did also experiment with the fablab infrared leds, which work great over short distances.
- I bought a headband in order to be able to use an elastic material.