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 repeated shift.

  • Workflow:

    • Run node on ir-serial.js
    • Open a page like dxh.plot.infrared.html in the browser.
  • wooden glasses (all one piece with flextured hinges!)

https://www.youtube.com/watch?v=2Nj167idFkQ

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

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

  1. The board for the camera. (image, schematic, traces, edges)
  2. The enclosure for the camera.
  3. 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.

Author: Dylan Holmes

Created: 2018-12-18 Tue 05:57

Emacs 26.1 (Org mode 8.3beta)

Validate