I don't want to commit to one project idea yet, but I do know that I want to make some sort of haptic feedback device. Given the time frame for this assignment, I wanted to make something simple to fabricate but within my area of interest, enabling me to begin exploring different tactile experiences. Therefore, I decided to make a device that electromagnetically "tickles" or "touches" (not sure what verb is best to describe the sensation) the user on the helix (top part) of the ear. The device will have an electromagnet that will push/pull a permanent magnet on the ear. This magnet could be pierced, but for now I am using two thin ones that attract to each other and clamp on the helix. I will attach the electromagnet to the frame of my working glasses as this provides a stable structure for easy mounting.
Applications
It is common for people to walk and text. This may lead to people running onto each other. Using this sutil alert system I could put a gyroscope on the frame to detect head angle, and a distance sensor on a hat to determine when the user is going to collide with an obstacle when it is not looking directly forward.
I often listen to music while working. When people are outside my office and they knock on the door I am unable to listen to them. I propose a system that detects knocks and alerts me using Electickle.
It could also be appropriate for navigation if mounted on both sides of the head.
It also reminds me of how my grandmother pulled my ears, so I thought it could be used as a cue for attention and emotional control. Children with attentional disorder could be reminded by the teacher in a subtle manner without other classmates noticing, eliminating possible social stigmas.
Process
Coil Spool Glasses Attachment
First I measured the frame of my working glasses. This is my second week at the lab so I don't have many tools yet, and I don't really know where things are. The only digital calipers I could find had no batteries, so I had to rely on the ruler it has on the metal... I felt like a primate! For it to fit tightly without damaging the frame I did a few test prints using the Ultimaker 2+. It was very well calibrated, I had no trouble using the settings I alraedy had on Cura for that specific machine.
Testing
I used a breadboarded h-bridge circuit I had built in Berkeley to test my haptic devices. It worked! However, the electromagnet barely moved. Now that I see the photo of the breadboard, I couldn've used the buck-converter to bump up the voltage from 3.3V to 5V. I can't make the spool taller or it could bump into my head, and I can't make it wider because it would look to bukly. I would love to learn how to make flexible circuit boards so I can make very thin coils. I could assemble a sandwich of coil-insulator-coil * n to make a powerful electromagnet without the need of a permanent magnet as its core.
Modeling my Glasses
Because of the simplicity of my copper spool glasses attachment design, I had a lot of time left. Therefore, I wanted to use this time to learn how to assemble different components and render them beautifully. I couldn't use an existing glasses .stl file from the Internet as it wouldn't fit my design, so I modeled my own by following a tutorial. This took my much longer than expected, but I did learn a lot, from taking photos of my glasses at 3 different angles, using sculpture mode, using physical materials for different bodies, to having silky-smooth realistic renderings of my design.
Assembling the Components, Exploded View, and Animation
Because when using the sculpture method one has to eye-ball everything, my glasses frame was not exactly the correct thickness. I had to modify my design for the coil spool attachment to fit on the frame. I then learned how to explode the different components, and finally how to record animations at different views as components explode.
⇜
Computer-Controlled Cutting
Week 2
{
Fusion 360
Laser Cutter
Vinyl Cutter
}
A group of people from my section met and did some test cuts. We first did a parametric design of the square, but thankfully the parameters we chose worked on the first time. The cardboard thickness was 4.3mm, and we chose 4.2mm. However, I decided to go for 4.1mm as it would add even more rigidity to the structure. Although the recommended cutting frequency was 200 Hertz, I wasn't able to get a clean cut - some edges wouldn't cut all the way through. I found 420 Hertz to be better at this.
Lessons learnt
When exporing DXF files from Fusion 360, all the construction lines are exported as normal lines, resulting in double lines which lead to the laser cutting cutting multiple times over an edge. Therefore, I had to import the file to Rhino, where I cleaned the file before sending it to the laser cutter.
For this week, I wanted to combine both assignments: laser-cutting and vinyl-cutting. Inspired by little bits,
I decided to do a very simple version using cardboard and copper tape. This would entail four different modules: power, input, output, and connectors.
Power
First Attempt
I started with the power module. My idea was to have one piece that would hold the coin battery. I wanted to use magnets on these flaps to hold the battery. I soon discovered cardboard is not very good folding, at least the shape I chose.
Second Attempt
I decided to go for a sandwich design which would hold the battery between the two breads. The power plane would go above and ground below.
Ouput
First Attempt
Exploded view (from bottom to top): cardboard unit, power trace, insulation layer, ground trace
Power trace placed on cardboard unit. More info on how to sucessfully cut and transfer copper tape traces below.
Power trace placed on cardboard unit. More info on how to sucessfully cut and transfer copper tape traces below.
Power trace placed on cardboard unit. More info on how to sucessfully cut and transfer copper tape traces below.
Power trace placed on cardboard unit. More info on how to sucessfully cut and transfer copper tape traces below.
Power trace placed on cardboard unit. More info on how to sucessfully cut and transfer copper tape traces below.
Second Attempt
Assembly
⇜
Electronics Production
Week 3
{
Eagle
Roland MDX-20
}
Milling the original design
Testing it
ATtiny45 Breakout
Given that there are no DIP ATtiny45s, I was forced to make my own breakout board for the SMD version. I added two LEDs, one for VCC and one for
Reset. This made my board look like a little bug. I soon discovered that what I thought were 0603 resistors and LEDs, were really 0805. Although it wasn't optimal, I didn't want to mill a new one, so I hackily soldered the components - it worked!
Lessons learnt
When exporting the board file from eagle we discovered that the export function was not working correctly, exporting the designs with smaller dimensions. Apparently, if you click print, you can save the file as a PDF. Then, usin GIMP, Oscar taught me how to create the different layers (top, holes, contour). I learned afterwards from Kreg that the export function (to PNG) creates a file half the size, so you can easily scale it by 2 instead of making a PDF. We also discovered that compressing the file into a .zip file is necessary or the email will compress the file and modify its dimensions.
Making my own: USBteenyISP
Schematic
I simply copied the schematic on Eagle. Given the availability of 0805 components, I decided to go with this size rather than making the board smaller using 0603s. It was a challenge: how small can I make the board with 0805?
Routing
It was a challenge. When I finished, the program crashed. I had to route it again, but this time it was smaller.
Milling
Traces 1/64
Traces .01"
Mask
Tool diameter 0.01 didn't work, used 0.005
At the end I run it again without Mask to be sure.
Contour and holes 1/32
1/32 not working, increase the cut depth and max depth, did almost nothing
Would recalibrate the evert time and cut a little bit deeper, over 10 times
Noticed that sometimes when I set the mill to the origin, it would get to the x and y position, but when going to the z origin it would go up and down several times and then stop.
I thought maybe a maximum depth was reached, and then realized I always calibrate the machine putting the endmill all the way inside. Raised the z origin and let the endmill lower a bit. My hypothesis was right, it cut right through.
Soldered
Order: USB, resistors, diodes, LEDs, MCU, header.
Tried connecting it to the computer and programmer but running make flash gave me an error. I saw that the light that is normally solid red in the programmer was blinkin orange. I checked the schematic and realized I had my reset connection was non-existent: one side RST and the other RES, so there were no airwires for me to route. I used a very thin wire routed below the SMD pegs to connect the reset from the MCU with the reset from the ISP connector. There were also two traces that were merged because of the precision of the endmill. I fixed it cutting it with a xacto knife.
Testing
⇜
3D Scanning and Printing
Week 4
{
Fusion 360
Sense 2
}
Cartón
3D Scanning
3D Printing
Cube
3D Printing
I have done FDM (fused deposition modeling) before, and have SLA (stereolitography) parts printed for me, but have never gone throught the whole process of SLA printing. Down at the fablab John doesn't allow me to print using the FormLabs Form 2, but fortuntaly there is one @Fluid! Arnav was very kind to teach me, instrucing me to put it inside the first alcohol mix for 15 minutes, 15 more in the next alcohol mix, and 1 hour next to the UV. Unfortunately, I was bad with these times and left it in the second container for whole hour, and 2 hours exposed to UV light. I think that's why it broke a little...
Oscar is bigger than the Cartón, and produces less complicated shadows, and thus the scan I did of him was much more accurate. It did take me a few tries to get the technique right. I must admit that the new location of the Sense 2 is far worse, making it difficult to scan big things like a humam being. The light is not the best either. However, Oscar did some
3D Scanning
⇜
Electronics Design
Week 5
{
Eagle
Roland MDX-20
C
}
This week I gave birth to rgbPaletteUSB: ATmega12u2 + LUFA
Motivation
I hated to use another device to program my boards. The motivation for this week's project was to solve that. I saw the some Arduino boards had a USB to UART IC and thought it would be a good idea to add that to my board and stop using my ISP programmer to flash code into it. I asked Neil about it and told me it was too slow, so I should either use V-USB, a software-only implementation of a low-speed USB device for Atmel’s AVRs, or to use LUFA (Lightweight USB Framework for AVRs, formerly known as MyUSB), an open-source complete USB stack for the USB-enabled Atmel AVR8 and (some of the) AVR32 microcontroller series. He said that the V-USB was to slow so the best way was to use an AVR MCU that had hardware support for USB. I looked into the fab class inventory and saw that the ATmega16U2 was available, and that there was a guide by Andrew Mao on how to use the ATmega12U2 with LUFA. This was my guide throughout this journey. Thank you, Andrew.
Design
Schematic
I pretty muched followed his design, but used a USB Micro and used a resonator instead of a crystal, which is basically a crystal with the two capacitors needed.
Board
Tried to route it in one layer and spent over 10 hours into it. At the end I gave up and used a 0 ohm 1206 resistor, and while soldering I had to use another 0 ohm 1206 resistor (which I will talk about later).
Fabrication
Milliing
Reduced the width of the traces that were very tight together to 0.01. Had to do two, Mods wouldn't mill my 0.01 traces, had to reduce to trace width on mods to 0.005 and speed 2, and althought it routed it, it blew some of my traces.
Increased the width of all my traces back to 0.012 and used the 0.01 endmill again, with the mill width on Mods set to 0.005 and in some parts masked it to 0.003. It was able to mill it but with some parts extremely thin. I am looking forward to learning how to use the fiber laser to be be albe to fab more stable boards.
Soldering
Thought a resistor on Andrew Mao's schematic had some value, so assumed I could find it in in 0603 component booklet I bought from amazon. When soldering, I discovered it was a 0 ohm resistor, and the booklet didnt' have it. Althought the size was for an 0603, I was able to solder the 0 ohm 1206 resistor available at the elab.
Programming
DFU
I had a lot of issues installing the avr-gcc library. First I tried using this tutorial, but I wasn't able to install avr-gcc. I kept getting this error:
Error: No available formula with the name "avr-libc"
I then found this repo, and was able to run the makefile.
I then spent 2 hours debugging the RGB LED that I used for my board. In the schematic view it can be seen that the top-left trace, which has the cornet cut, is the red LED, and the top-right is VCC. However, it is not like that! I used the multimeter's VCC is actually the trace below the cut corner (red LED). I then checked Andrew Maos's PCB and he did rotate the LED in the new orientation I discovered. I guess he forgot to document that small yet hard-to-find issue! I had to desolder the LED with the heatgun and put a new LED. It worked!
LUFA
LUFA's keyboard demo mapped modifier keys to the LEDs. I didn't want to use th RGB LED for that - I wanted to do an RGB palette. I changed the following methods:
Testing!
⇜
Computer-Controlled Cutting
Week 6
{
Fusion 360
ShopBot
}
This week I gave birth to a Nazca line
Motivation
This week I wanted to do something related to my country, my culture, my home. Therefore, I decided to make one of the Nazca Lines, huge ancient geoglyphs made by the Nazca culture between 500 BC and 500 AD, but in 3D!
Design
I googled "nazca line spider" and found a black and white image. I ripped the legs apart and made the slots for press-fitting the legs into the body.
Thanks Oscar for helping me out!
Fabrication
Nope, I didn't use a wooden axe to cut this, I used the all-mighty yet temperamental shopbot!
After rocking the spider's body, I had to file the its slots for the legs to fit. Apparently, the thickness of OSB is not uniform at all.
I organized the parts so it resembles the original Nazca line:
And then took the spider for a walk!
Then I went to eat at a Peruvian restaurant called Machu Picchu where I found the Nazca Lines!
⇜
Embedded Programming
Week 7
{
Eagle
MDX-20
C
}
This week I TRIED to make a Peltier driver... but my mom came to visit me so I couldn't fab over the weekend.
Motivation
I'm interested in using heat and cold as thermal feedback for applications that aim to help with attention and emotion. In particular, I want to build hardware to recreate the thermal grill illusion, a tactile illusion I learned about a few years ago in a neuroscience classes. I am curious to test if this could be useful for providing negative feedback for operand conditioning.
Design
This board is composed of an ATmega16U2 as the MCU, a USB Micro, a LiPo, a charging circuit, a step-down, a button, an RGB LED, and an H-Bridge.
Schematic
Board
After 7 hours of routing I was very close to having a final board layout. Unfortunately, Eagle crashed and I had to re-do it. The second routing took me longer to having it clean and polished. I really want to learn how to do double layer to make this simpler and smaller.
Fabrication
Milling
For this board, I did 3 passes for the top layer (excluding contour and holes).
Tool: 1/64
Mods Tool Diameter: 1/64
Speed: 4
Offset #: 4
File: top
Tool: 0.01"
Mods Tool Diameter: 0.008"
Speed: 2
Offset #: 2
File: top
Tool: 0.01"
Mods Tool Diameter: 0.06"
Speed: 1
Offset #: 1
File: top masked
Soldering
My circuit required 4 0603 10uF ceramic capacitors, 2 for the lipo charger and 2 for the regulator. Unfortunately, my 0603 component book didn't it. After half an hour of searching for one between fluid's messy hardware drawers, I found some 0805s... these will do.
My LDO wasn't working, it was giving 2.7V for a bit and then stopped working... even the battery gave me ~0V. I remembered about the dropout voltage and realized I need 3.3V + 1.2V for it to work. I used a power supply and verified my hypothesis, the regulator now had a stable 3.2V output.
I stabbed myself with my new pair of tweezers.
I also realized I wired the green LED of the RGB LED to a PWM instead of blue.
It's 6:00am in the morning and I've encountered a wall. I used the wrong footprint for my h-bridge and now I can't solder it... this is what I have so far. I'm sad. I may have lost the battle, but I haven't lost the war yet.
Programming
To be continued! Thankfully, for the Electronics Design assignment I did embedded programming. I fabbed a 3-button USB keyboard with an on-board RGB LED light. It had three buttons, each corresponding to each color, and to characters R, G, & B respectively. By pressing different buttons you could mix R, G, & B to make 7 different colors! This was implemented on C and using the LUFA framework. It was great learning how to write drivers for the different IO elements, making the code more clean and structured.
-----------------------------------------------------
FabFTDI
I met with Prashant Patil and tested the code he wrote based on LUFA to use an ATmega16U2 as an FTDI cable. We uploaded the .hex file onto the RGBPaletteUSB board I made for the electronics design week. My device was no longer recognized by the computer, and Prashant assumed the problem was with the hardware as he had succesfully made it work with another board. He also mentioned he made different boards and it didn't work on all of them. He had to use a crystal instead of a resonator, and 18 ohm resistors for impedance matching on the USB data lines. Something was fishy - I had been able to run LUFA with a resonator and 22 ohm resistors... He said I should check the hardware before attempting again. I was sure it wasn't a hardware issue. I ran downstairs, grabbed the heatgun and removed the ATmega16U2. Oscar then assisted me by grabbing the heatfun while I replaced the MCU - it was as risky move. Part of the board burned (see below), but I was able to succesfully replace the MCU and perform a real HARD reset. My board was recognized again, I uploaded my previous code, it worked. I ran upstairs to CBA to talk to Prashant. This issue was enlightening as we isolated the problem to the software, not a hardware bug as Prashant initially thought. I was relieved.
⇜
Molding and Casting
Week 8
{
Fusion 360
ShopBot
Oven
}
This week I used PDMS to make a flexible wristband for a Peltier module.
Motivation
Last week I tried to make a circuit board to drive a Peltier thermoelectric device. I want to recreate the thermal-grill illusion, but I am also interested in making a personal thermostat, similar concept to the wearable thermostat Embr Wave and Aircon Watch, but used for biofeedback applications.
First try
Molding
Casting
Second try
This time I made the negative using the CNC mill as I am going to cast the PDSM in the machineable wax directly. The borders are too long and thin to be extracted so there is too much risk of breaking the oomoo (2nd) mold, and then again the PDSM part. Also, I was strongly advised not to cast silicone in a silicone-based mold.
Casting
For this board, I did 3 passes for the top layer (excluding contour and holes).
The big container has the PDMS and the small one the curing agent. The standard ratio is 10-1, the more PDMS, the harder it cures.
Grace told me his ex-boss taught her to mix every fluid in its container first, and mix the fluids, mix them again scratching the sides again and again.
I debubbled the mix for 30 minuets using the vacuum degasser, puoured the mix in the mold, and degassed it again for 30 minutes.
The antistick spray was brought up by the degassifying process. There's also a big hole, maybe a bubble?
I was using a metal piece and the action got intense so I cut my hand.
It was too hard to I just grabbed a chissel and a hammer.
Boom.
I rushed fitting the wristband into my hand and I broke it... even before taking the photo.
Looks nice though.
I need to make the wrist bigger.
Third try
This time I made the wristband inside oval dimensions bigger to fit my hand, from 30x60mm to 40x70mm. I also decreased the size of the Peltier holder to be a tad snuggier, from 31x31x5mm to 31x30x4.5mm.
This time I didn't add the non-stick spray because of the weird residues, and because I am going to break the mold anyway.
⇜
Output Device
Week 9
{
Eagle
MDX-20
C
}
This week I tried again to make a Peltier driver...
Design
This board has an A4953 H-Bridge instead of the other one I tried on week 7. I had previously discarded this IC because in the datasheet it states that it needs a VBB of at least 8V, and at most 40V.
However, Neil recommended me to use this IC because it could low load voltage and low logic voltage of 3.3V.
Schematic
In order to limit the current my H-Bridge can draw with a 3.3V reference and a gain of 10 (specified on the datasheet), I had to select a 0.033ohm resistor. I bought a bunch of 0603s from digikey.
Board
I made the layout more rectangular so it could fit in a bracelet. The new H-Bridge added a lot of space, especially that 100uF electrolytic capacitor.
Fabrication
Milling
For this board, I did 3 passes for the top layer (excluding contour and holes).
It was a challenge to solder the ground pad below the IC. I first put too much solder so the IC wouldn't sink. I took some out and asked Safinah to help heat the other side of the ground pad from the other side. It took me a while to lay it out but it all worked out.
Programming
Makefile
Interrupt Setup
ISR
PWM
Main
Debugging
The whole board is working fine, except the H-Bridge. I am succesful at doing PWM, so the input to the H-Bridge is correct, but the output incorrect. I get 3.3V at both outputs with IN1 = 1 and IN2 = 0, and IN1 = 0 and IN2 = 1. Becasue the logic of the ATMEGA16U2 is 5V, I tried using PWM to just send 3.3V, with a duty cycle of 66%... but nothing. It must be the fact that my VBB is 3.3V and the minimum VBB specified on the datasheet is 8V.
3.3V (top) to 5V Reg (bottom
5V
VBB = 8V, VREF = 5V
⇜
Pancake Machine
Week 10
{
JavaScript
Shopbot
}
This week I worked with the rest of the CBA on a multi-shade pancake printer!
Software
Bandpass-Filter Mod
I forked the image threshold mod and added a second threshold. This bandpass filtering enables creating toolpaths for specific gray ranges (assuming grayscale images). We used an offset number of 2 and an offset stepover of 1.
Mod Architecture
For a first proof of concept, we (Pinar and I) wanted to do two different layers, outline and the darkest features, and the rest. For this, we duplicated the new raster mod with dual-threshold and connected it to the "read png mod", and added all the other mods that procede the original threshold mod. Sean made a "concat mod" that could receive multiple inputs and concatenated the produced gcodes with a dwell (delay) in between. The only problem we faced was the rastering of the filling. We weren't able to find a combination of offset number and offset stepover that produced an adequate filling path.
Hardware
CNC Pinion
We did five passes using 3 tools: 1/8th, 1/16th, and 1/4th. The first two were made with the 1/8th, the next two were fine detail and made with the 1/16th, and the contours with 1/4th. I cut my finger taking the HDPE where I cut the pinions out of the piece of OSB.
Building Machine
I first mounted the three motors on their respective holders. This was not trivial because the bolt barely fit next to the motor, and because the bolt needed that much torque for the screw to pop in, the screwhead would strip in a blink.
⇜
Input Device
Week 11
{
Eagle
Roland MDX-20
Arduino
Objective-C
}
This week I made the hardware for a dream machine!
Motivation
A couple of friends from Fluid and I are working on a dream machine. With this hardware we aim to detect the onset of sleep and interface with our hypnagogic state of cosciousness to enhance creativity.
Hypnagogia
In this transitional state from wakefulness to sleep, different mental phenomena manifest, such as lucid thought, lucid dreaming, hallucinations, and sleep paralysis.
Edison, Tesla, Poe, and Dalí each accessed this state by napping with a steel ball in hand to capture creative ideas generated in hypnagogic microdreams when it dropped to the floor below.
I placed all the sensors on the right side of the board and the programming and power on the left side. I added a slide switch to turn the device off when powered with the LiPo battery, but also when programming.
Although the NRF52 is smaller, I chose to use an RFDuino because I didn't need that many pins, and because I forgot to order the raspberry pi to program the NRF52 so I decided to go with something that I knew I could finish on time. Nevertheless, I plan to use the NRF52 for my final project.
Fabrication
Programming
ADC
There was interference between the different sensor channels, such as the heart rate signal affecting the GSR signal. To solve this I flushed the ADC register by reading the new sensor, having a small delay, and reading again. It worked like magic. Thanks for the tip Abhi!
Plotting
I have used Arduino for years, but this was the first time I plotted multiple signals on their serial plotter. The trick is to separate the prints with a comma, and do a println instead of print on the last value.
Bluetooth
Testing
Arduino Serial Plotter
Blue is heart rate, red hand flex, and green EDA (but just testing by shorting the electrodes).
Bluetooth iOS App
Testing EDA
Song: Planet Caravan - Black Sabbath Participant: Abhinandan Jain Sounds effects: Tomás Vega Lights: Off
⇜
Interface and Application Programming
Week 12
{
Node.js
D3.js
HTML
CSS
}
This week I made a web application for dream research! Repo.
Motivation
Check week 11 to find out why I'm doing this!
Server
Bluetooth
I cloned this repo, which is a project that uses the noble bluetooth wrapper for OSX to interface with an RFDuino. However, it didn't work, I wouldn't recognize any RFDuinos. After hours of googling, I found this github issue, describing how the new OSX, High Sierra, messed with the framework. Fortunately, someone was able to fix it by adding a file and linking that file on a config file. It worked!
After I was able to connect, I intercepted the data and piped it to my own logic.
Socket
I used socket.io to send data to the client-side using.
Client
Plotting
I implemented the client-side socket to receive the data. Then I used this gist as a starting point. It was the first time I was using D3.js, but it was quite trivial. I adjusted the x and y axis to fit my three channels. In order to fit all of my channels, I had to use a very a wide range for the y-axis. This results on plotting that looks very digitized. In the future I will have separate plots for reach channel and a dynamic y-axis.
User Interface
Data Panel
I added a right panel with a block for each of the three channels. Each block is color-coded, matching their corresponding plot. I made the BPM box more opaque when a heart beat is detected.
Session Info
In order for this interface to be not only for visualization purposes, I added a top panel to record experiment sessions. When recording, the dot next to the "record" button turns red.
Saving experiment sessions
I used JavaScript to listen when the "record" button was pressed. The value changed from "Start recording" to "Stop recording", and the input boxed were disabled. I used the socket to send the user info to the server, open a file stream, and write the user info. This enabled data logging every time data is received.
BPM
Pair-programmed with Abhi.
Count beats with refractory period
We first tried to count each beat by comparing the current data point with the previous one, and if the difference was beyond a threshold, it would add a beat. To compute BPM, we need the number of beats per minute. However, we didn't want to update every second, but have a more dynamic value. Therefore, we counted every 12 seconds and multiplied the number of beats by 5.
Although the second part of the beat has a smaller amplitude, the algorithm would catch it. This was because the threshold set was too low, but good enough to prevent false negatives. To fix this, I got inspired by the refractory period exhibited in neurons and implemented it. I guess it is like debouncing...
For visualization purposes, I made the BPM channel on the UI change to a more opaque red every time a beat was detected.
We discovered that the sensor works better for some people depending on how they grab it, where they put it, and their skin thickness. It worked okay with me, amazing with Abhi, and pretty bad with Orson.
In the future, we will implement a dynamic threshold.
Running Average
The drawback of the previous algorithm was the loss of resolution as we were computing the BPM every 12 seconds... and it was always a multiple of 12! To improve this, we implemented a running average. For the first 59 seconds, the BPM value shows 0. When 60 seconds pass, a buffer with all the values (we counted it to be 117 per second) would be processed with the same algorithm as before. After 1 minute, the BPM value would be recomputed every second using a sliding window. For this, we used the JavaScript Array Push and Shift methods
Multi-threading
There was a little bit of lag after 1 minute, as the BPM had to be recomputed constantly. Threfore, we used a multithreading library for client-side JS. After implementing this, we realized we were modifying the prev and now global values in multiple methods. We fixed this and it all worked smoothly. Therefore, we don't know if the multi-threading was necessary. However, it doesn't hurt.
https://keithwhor.github.io/multithread.js/
Benchmarking
We compared it with the Empatica E4 (thanks Fengjiao for lending it to me with such a short notice!). It did pretty well! Apparently, the E4 doesn't have an OSX app, just mobile apps. However, it does have an app to download sessions to your computer, but not live stream. On the contrary, we do have an OSX app!
We also found our stream to be more responsive.
Acknowledgements
Thanks to Abhi for being such a badass and helping me throughout the process. Excited for the future of this project.
⇜
Networking
Week 13
{
Eagle
Roland MDX-20
C
Node.js
}
This week I tried to make a BLE earring for detecting jaw gestures!
Motivation
I'm very interested in developing seamless I/O interfaces. A few weeks ago I had the idea to paste a magnet on my jaw, and use hall sensors on my ear to measure the distanace to it.
Hardware
Design
BC832
I want to get the BC832, a castellated form-factor of the NRF52, working for future projects. This is my first attempt.
Hall Sensor
I first checked the datasheet of the hall sensor - it needs at least 4.5V. Unforunately, the BC832 is a 3.3V chip, and I was planning on using a LiPo (~3.7V) to power the whole thing. Therefore, I tested with an external power supply and an oscilloscope if it works at 3.3V. I connected the power supply and oscilloscope using alligator clips... and voila, it worked (not like the horrible A4915 which needs at least 8V).
Tag Connect
I saw how Sam used a 6-pin pogo connector, so I asked him about it. They are called tag connectors, and he gave me one! I downloaded the eagle device from the tag connect website.
Design
With multiple hall sensors on one plane, I could theoretically measure 2-degrees of freedom. With a 3D PCB I could do 3-degrees! However, I want to first try to get at least one-degree of freedom. Nevertheless, I added three on the same plane just in case!
Fab
Tool diameter (in): 0.0156
Cut depth (in): 0.004
Max depth (in): 0.004
Offset number: 4
Speed: 4
File: top
Tool diameter (in): 0.01
Cut depth (in): 0.004
Max depth (in): 0.004
Offset number: 2
Speed: 2
File: top
Tool diameter (in): 0.0312
Cut depth (in): 0.024
Max depth (in): 0.072
Offset number: 1
Speed: 4
File: dim
Forgot to invert colors in the contour milling! Had to do it again.
Software
Programming
I first tried to follow Sam's tutorial to get the Raspberry Pi working with OpenOCD. I failed and won't elaborate much.
I then tried to use the JLink. When trying to run the first command "nrfjprog -f nrf52 --eraseall", I noticed I didn't have nrfjprog. I downloaded it from here. However, I kept having the same error. To solve this, I added an alias on my bash_profile "alias nrfjprog='/Users/Tomasero/Downloads/nRF5x-Command-Line-Tools_9_7_1_OSX/nrfjprog/nrfjprog'", and used "source ~/.bash_profile" to reload it.
I then got "ERROR: JLinkARM DLL not found. Please reinstall latest JLinkARM.", so I went here and installed the JLink Software. Then I downloaded the bootloader by googling its name. I found that using wget to download it produced an error when burning the bootloader. Just download it from the git repo. After this, I run "nrfjprog -f nrf52 --program feather52_bootloader_v050_s132_v201.hex" and "nrfjprog -f nrf52 --run". It worked! I tried uploading a simple blink sketch using the "Generic nRF52" board, and "J-Link" as the programmer"... it uploaded succesfully but I had no way of testing it.
I first wanted to test if the board is working, so I decided to use Adafruit's code. For this, I followed this instructions to install the Arduino Core for Adafruit nRF52 Feather Boards. I got this error: "fork/exec /usr/local/bin/nrfutil: no such file or directory". I cloned this repo, and followed the instructions found on the Adafruit_nRF52_Arduino repo (previous previous link). After running "sudo python setup.py install", I had the same error, so I made a symbolic link: "sudo ln -s /Users/Tomasero/.pyenv/shims/nrfutil /usr/local/bin/nrfutil", restarted arduino, and it compiled! However, I wasn't able to upload the code. When using the "Generic nRF52" board, it didn't even compile because it couldn't find "bluefruit.h". When using the "Adafruit Bluefruit nRF52 Feather", it compiled, but it did't upload. I get "Failed to upgrade target. Error is: Serial port could not be opened on /dev/cu.usbserial-DJ0081T4". I think that Adafruit uses the serial port to upload... and I want to use SWDIO and SWDCLK with the J-Link. I am stuck. Thankfully, I already did bluetooth last week!
⇜
Composites
Week 14
{
Fusion 360
Shopbot
Epoxy
}
This week I made a snowskate!
Motivation
I've always wanted to learn how to make skateboards. When I was about 15 I tried to make my own skateboard brand, and paid a huge amount of money to this guy who supposedly fabricated the boards for other Peruvian skate brands. Long story short, this guy escaped to Cusco with my money and never came back... my dream of making Nimbus, the best Peruvian skateboard brand died. 8 years forward, I'm at MIT, I don't skate anymore, but am interested in snowboard.. maybe I can make my own. However, I wouldn't trust going down a hill with a board I made myself... yet. For this reason, I decided to make a snowskate, which is basically a shorter snowboard but without any feet attachments. I aim to use it to slide through campus, and try to boardslide the rail found on the tennis court between the Media Lab and the Muddy.
Design
I copied the shape of a high-ranked snowskate I found online. The only thing I didn't add were the rails on the bottom of the board. This might be for the next iteration! The 3D modeling was done in Fusion 360. Oscar helped me to unroll the top surfaces - he is the master of Rhino!
Fab
Mold
I used a 1/2" for the roughing path and 1/4" for the finish path. Because of my settings, it didn't cut all the way through, so I used a xacto knife to cut the contour.
Layers
At first I tried to use the laser cutter to cut the layers, but the bedsize was too small. Grace gracefully arrived and offered to help us to use the Zun! We combined our files together and learned how to operate this amazing machine. ZUN! All the layers were cut! This machine is amazingly fast.
I used a total of 10 layers, plus a colorful patterned layer that Grace gave me to add an aesthetic touch to the bottom of my board.
Finishing
There's a lot of extra material that I need to get rid off! Neil was around so I asked him for advice on how to proceed. He recommended me to use the band saw, and the circular sanding machine!
Band Saw
Circular Sanding Machine
Clear coat
I did a final clear coat using epoxy on both sides and the edges. This will not only give it a nice shiny look, but also smooth out all the irregularities, and seal the edges. I gave my board such a thorough rub, that my gloves broke and my hands got exposed to the epoxy. Thankfully, Safinah was next to me and helped me take my gloves immediately so I could wash my hands.
⇜
Final
Final Project
{
Eagle
Roland MDX-20
Fusion 360
Arduino
Swift
}
Here we go
Motivation
At the beginning of the semester I started playing with a Peltier thermoelectric device. In week 5 I made a board with an ATmega16u2 and an A4953 H-Bridge IC. I failed because of the power constraints of the bridge I was using. For my final project I didn't know was to do. OpenSleep is almost done, I just have to do a glove to mount everything... but I wanted to do something that required a little bit more effort given that was almost done. I had started other projects but didn't finish them: the thermoelectric wearable and the jaw gesture sensing. Given that I didn't get the NRF52 working, the jaw gesture sensor was discarded as it needs a very small form factor. Therefore, I am going to finish the thermoelectric wearable.
Hardware
Design
MCU
Although I was able to program the BC832 (NRF52) succesfully, I didn't have enough time to get the bluetooth conectivity working. Therefore, I decided to use the RFDuino (RFD22301), a Bluetooth 4.0 Low Energy BLE RF Module with Built-In 16MHz ARM Cortex M0 Microcontroller. I have experience with this MCU so I feel confident I can get it workign with the H-Bridge.
H-Bridge
Will showed me the DRV8838 and I bought them. This tiny chips are awesome, they come in a 8-Pin WSON package, can handle up to 1.8A, accept a logic voltage of 1.8 to 8V, and a load voltage of 0 to 11V. Last but not least, it uses a PH-EN configuration, which means that you only need one PWM pin to set the duty cycle (EN), and one digital pin to set the direction (PH).
After many failures, I thought I was about to get it fabbed correctly. Innocent Tomás downoaded an eagle footprint of the WSON8 package. Innocent Tomás didn't check the dimensions and assumed they were right. After almost being done, I had to remake it once more to adjust for the correct footprint.
Tag Connect
Sam recommended me to use the tag connect to program my board. This is great because the footprint is tiny! The connector uses three reference poles, and 5 pogo pins to establish a connection.
Vias
Great resource by Amanda!
For the 0.6mm rivets, the best hole sizes fell in the range diameter = 0.83-0.89mm. I chose 0.83mm (0.033 inches) to get a snugger pressit so that I could flip aroudn the board without the rivets falling out. I also wanted the hole to be at least the size of the 1/32 endmill because I don't want to use the 1/64 to mill through the board. Thankfully, the 1/64 endmill is about 0.79mm, which is thinner than 0.83mm. However, next time I would use 0.84mm to make it easier to pressfit the rivets... I had to use the back of a pair of tweezers to press it in.
Postprocessing
Make sure that all images have the same margin on both sides. For some reason Eagle doesn’t export just what is inside the dimensions.
The horizontal distance between both sides of the top plane polygon and the sides of the board contour must be the same. Even when exporting like this, the distance on both sides is not the same. To solve this, I used GIMP and made them equal. First I measured the difference, then added that to the smaller side, as well as a OFFSET of the same distance.
Eagle also exports the design 2 times bigger. For this, just scale the image in half.
SUPER IMPORTANT NOTE ON BOTTOM LAYER POSTPROCESSING
Origin: XY - (1/32)
Flip design horizontally
Fab
Top Rough
Tool diameter (in): 0.0156
Cut depth (in): 0.004
Max depth (in): 0.004
Offset number: 4
Speed: 4
File: top
Tool diameter (in): 0.0156
Cut depth (in): 0.004
Max depth (in): 0.004
Offset number: 4
Speed: 4
File: bottom
Forgot to invert colors in the contour milling! Had to do it again.
Vias: Punching the Rivets
As described by Amanda (link above on via milling section), I first placed the rivets on one side. I then flipped it, and placed the PCB on a metal block. Then I used the pointy punch and lightly hammered the punch with a hammer. After this, I used the flat punch and a hammer to finish it off.
Reflow WSON8 H-Bridge
First, I tinted both the H-Bridge and the PCB pads with solder. I used a lot of flux to prevent both the H-Bridge and the pads from overheating and burning. I then placed the H-Bridge on the pads, and used the hot air gun to reflow it. Finally, I added more solder on the sides to secure it in.
Debugging
After soldering everything, I started debugging, checking that all the things that should be connected were connected, and the things that shouldn't were not! I found a bug chillin on my board! Then I found the real bug, I had broken a bunch of my traces when punching the vias. To fix this, I added solder.
Everything seemed fine, so I went ahead and tried the charging circuit. The status LEDs seemed to work, but I wasn't able to talk to the board. Apparently, the lipo charger was charging battery up to 4.2V, which was way above the 3.6V limit the RFduino can handle. So I had burned my MCU... I grabbed the hot air gun and took it out, fearless of burning my board... there was no time to lose. I rapidly cautiously replaced it with a new RFD22301, but before plugging the charger in, I operated on the back of my board to add a SOT23 3.3V step-down regulator. This was perfect: the regulator needed above 3.7V to drop-down to 3.3V, which would prevent my board from burning when the battery was charged up to 4.2V. When the battery voltage drops below 3.7V, the regulator would drop below 3.3V, but but it was fine as the RFduino only needs 2.1V to operate.
I present the therm.o hardware!
Software
Programming
My board was still not responding. I realized I forgot to connect the ground of the RFduino programmer to my PCB... I just had to add it to the tag-connect. Therefore, I used an external wire to connect the grounds. The board woke up! The tag connect worked amazingly. I added some solder on the pads to make it more robust and prevent the bads from breaking from constant use.
Embedded Code
I used the Arduino IDE to program the RFduino. To enable a bluetooth connection, I first wrote "RFduinoBLE.begin();" on the setup() method. On the loop method, I wrote "RFduino_ULPDelay(INFINITE);" to enable the ultra low-power mode. Finally, I implemented the "void RFduinoBLE_onReceive(char *data, int len)" method to receive data using the RFduino library. From the iOS side, I sent three bytes. The first one being the state (on/off), the mode (hot/cold), and the power (0-100).
Brian Mayton from Responsive Environment taught me that cooling efficiency for a peltier is a function of the average current, but resistive heating is a function of the instantaneous current. Therefore, I had to implement a low-pass filter to keep the instantaneous current closer to the average current. However, I didn't want to add more hardware, so he suggested decreasing the PWM frequency to a low range of 1 to 100Hz. To do this, I found a forum that guided me. I went to the Arduino Preferences, and enabled verbose output during both compilation and upload. From there, I was able to find where the wiring_analog.c file was. For me, it was here: /Users/Tomasero/Library/Arduino15/packages/RFduino/hardware/RFduino/2.3.3/cores/arduino. The timer frequency is defined by clock_freq/(2^prescaler)/(2^bitmode). The default prescaler was set to 0, and the bitmode to 16, giving a frequency of 244 Hz. I verified this with the oscilloscope.
Ideally, Brian said I would use 1Hz. However, it seemed like all the pins on the RFD22301 were tied to the same timer. Therefore, at frequencies below 60Hz I was able to see the the duty cycle of the RGB LED. To solve this, I decided to set a frequency just above 60Hz, which seemed to be outside human perception. Thus, I used a prescaler of 2, giving me a frequency of 61Hz.
iOS App
On the iOS side, I made a simple app. There are three controls. A toggle switch to turn therm.o on or off, a segment controller to change the mode to make it hot or cold, and a power slider to regulate the intensity of the thermal feedback. When the state was off, both the mode and the power are disabled. When a mode is chosen, the tint of the slider changes to reflect the current mode.
When a control was changed, a global variable would be updated, and the updateSettings() method called. This would check if there was a connected device, marshall the data, and then send it using the BluetoothCore framework.
Case
I modeled and assembled the case using Fusion 360. The parts were printed using the Form Labs durable resin. The outermost case holds the peltier, which is sandwiched by two thin aluminum layers. The bottom one is purely aesthetics, and the top one is supposed to work as a heatsink. The buffer goes above, which holds the LiPo battery, adn the PCB. I added a thin layer below the PCB with holes for the 3.3V regulator, caps, and resistor I had to add. The bottom and top parts of the case are connected using magnets! Final
I first tried to design the straps for myself, and did some tests for tolerance. However, for time sake, I decided to use my Apple Watch straps, and make a slot for it to slide in. Nevertheless, this slots were not as tight as I thought they were, so had to use superglue to fix them in! No pain, no gain!