# Week 5 - Electronics design

This week the assignment was to add an LED and a button to a generic board. I've done a bit of circuit design already I decided to work on a circuit for my final project.

## Motive behind the circuit

Before arriving at MIT I worked with the Coded Structures Lab at the NASA Ames Research Center where I helped developed a robotic assembly system for the construction of digital cellular materials. As a progression of this project I have been helping with the development of a relative robot, capable of traversing through the structure whilst carrying out inspection of its condition. Whilst assembling these structures by hand, we realised that the vibrations were transmitted very differently through the structure when a broken or unattached voxel was present. Therefore, this week I've designed a circuit that I can use to experiment with different vibration sensors.

## Circuit design choices

I settled on using a piezo electric transducer to convert mechanical vibration into an electrical signal which will be processed using the ATTiny 44. This week I worked with two types of piezo transducer; a Piezo Electric Disc and a surface mount Shock Sensor.

Eric gave me a lot of tips regarding different circuit types. Below is a diagram of my final circuit with descriptions of what each section does. This is still a work in progress.

### Choosing resistor and capacitor values

Circuit section 2 - I first experimented with the piezo transducers that I wanted to try out using an oscilloscope. The disc produced a peak voltage of around 10 V, thesurface mount device produced a peak of around 500 mV. In wanted to bring the output voltage of the disc piezo trasnducer into the range of 5V. The oscilloscope can be modelled as a 1M ohm resistance, therefore I chose to use a resistance of 1k ohm. Given the output peak of the surface mount signal is so small, I didn't include a resistor in this section.

LED resistors - These are set according to the forward voltage of the LED, as specified in the datasheet. Assuming a required current of 20mA, I chose to use a 100 ohm resistor for both the LEDs. It was interesting to learn that the voltage drop across an LED normally rises as the light frequency increases, meaning that different coloured LEDs have different voltage drops.

## Designing the schematic and board using KiCad

I'd previously used Eagle to design boards but thought I'd give KiCad a go. One good/bad thing about KiCad is that it separates the assignment of parts and footprints. This is bad when you're starting out as it adds another level of complexity to the design process and file management The fab.lib and fab.mod files were ported using an automated process directly from Eagle, as a result I found that pin assignments given in the schematic for the ATTiny44 didn't translate correctly into the footprint on the board. I overcame this by using the SOIC14 package that is included with KiCad as standard.

• Hotkeys - KiCad allows you to use single key commands to do things like move and rotate components, edit values and assign footprints. This really speeds up the design process, an list of these hotkeys can be found here.
• When assigning footprints to your schematic it's important to know about the different package types that components come in. Sparkfun provides a good tutorial on this, the picture opposite is taken from that tutorial.
• THe KiCad community provide some very detailed tutorials, I found this one particularly helpful, particularly when trying to add my own component and footprint.

### The schematic

This was fairly straight forward once I had figured out how to install fab.lib and fab.mod. The Electric Rules Check function is helpful although it makes you add 'no connect' symbols on any pins that aren't being used.

### The board

I've yet to resolve one issue regarding the labelling of parts. When I first designed and netted the schematic, I hadn't given the components particularly descriptive names. After routing all my traces I went back to the schematic to change names and values of the components and reread the netlist, the program brought in a whole new set of parts. I think there's a way around this using a certain combination of checkboxes when reading the netlist but I haven't figured out quite what combination this is.

## Fabricating and stuffing the boards

I fabricated two boards in order to test each type of sensor. Unfortunately during testing I ripped up the UART input pins by applying too much force, therefore, in the future I'm going to use through hole pins.

## Testing the boards

The following two videos show the signal generated with the sensors hooked straight up to the oscilloscope in comparison to the signal after being filtered by the circuit. The first video shows that the amplitude of the signal has reduced and chopped, however the output the low pass filter hasn't extended the peak correctly, therefore I'll need to go back and try out a different RC combination, probably using a higher capacitance.

For the second video I removed in the gain resistor. The signal comes out differently from this component. I'm keen to proceed with this one due to it's size however I'm going to need to iterate on the current circuit design to get a useful signal out.

## Next steps

I now have a much better idea about how to go about researching circuit types to sculpt signals. The first thing I need to do next is learn to program the ATTiny sense and analyse the signal. Secondly, I need to attach the sensor onto a voxel structure and iterate on contact methods and circuit design until I get out sufficiently different signals depending on whether a broken or unattached voxel is present or not.

## Notes from class review

• Image processing in mods uses bitmaps (which is a discrete representation of the image as a lattice of points) to allow it to use distance transforms, edge detection and the rest of tool pathing far more easily than with an image formed of floating points. Based on this fact you need to output your design with sufficient resolution for mods to be able to generate tool paths. For example, if you have traces with widths of 15 mil then you need to export your image with a resolution thats a couple of times lower than 15 mil.
• When locating the 6 pin UART header, make sure that the black plastic piece sits on top of the board to minimise strain on the solder and traces.
• Before routing a board, try sketching possible footprint arrangements on a piece of paper in order to figure out which groups of parts should be close to one another and roughly which orientation they should be in.
• Solder rivets allow you to manually add vias when fabricating a two sided board. In order to mill a two sided boards, mill traces and outline for the first side, then remove only the board, leaving the excess material with a whole inside and use that hole to register the upside down board to the bottom left corner, and adjust x and y zero by the diameter of the tool.
• Another way to add make a multi sided board additively, using layers of 3M adhesive and copper foil.
• Multiplexer - Takes switches as inputs and lets certain signals through depending on the combination of switches. These are now built into ATTiny44's. If you need more pins that the ATTiny44 permits, you can just choose a larger package or network multiple ATTiny44's.