Menu

Wanted to create an RGB sensor for my final project. But will need to order that sensor and will need to understand I2C interface with ATTiny. So instead tackled the Sonar distance which I could possibly use also. Got a bit behind this week partly due to weekend warrior duties but designed the circuit and the code.

Trying to Prep for Final Project

For my final project I will need a proximity sensor to tell my serving table when to tranform to a dining room extender or a desk. The simple way would be to have two sonar distance sensors at side and back of the table. When the serving table senses the dining room table next to it, it will extend both benches. When it senses a wall behind it, it will become a desk. To prep for the final project and next week, I wanted to design this weeks circuit with an ATTiny 45 and choose ports that would enable me to use the same basic design for the the output next week where I will try and attach it to a DC motor. Below left is the original sonar input and below right is the DC motor output board. Laying out the port and choosing the traces is always harder than it seems with a 1d board! Notes: I used 50mm traces for most paths. I used 40mm when going through ATTiny44 and when I had to make one annoying one through the ISP. Those large traces were done mainly because I am not great at soldering.

Creating the schematic using KiCad

I used KiCad again. Here is a link to a great site that documents the workflow of KiCad. In order to add the sonar component, I had to create a new footprint with just four prongs. I took the FTDI header and deleted two of the footprints. Not the most elegant way, but it seemed to work. Below the sonar component, new footprint and the final design.

Download the full KiCad file:

This week I used imagmagick to correctly convert the SVG files to PNG files from KiCad using help from Harvard's TA Rob Hart. Thanks! 1. Creating in Kicad a graphic line around the board on the Edge.Cuts layer. 2. Then export two SVG's from Kicad: First one with F.Cu selected, then one with Edge.Cuts. 3. Convert with Magick: "convert -density 1000 -units PixelsPerInch x.svg x.png". 4. In mods, the traces run as converted. 5. For the outline, invert the image. The tool will take away a tool-width of board - just need to account for this in your design. The edge file needs to be You can download the PNG files here:

Recoding the C code for sonar

This was pretty simple since I just redefined the pins from the ATTiny 45 to the ATTiny 44. I kept all of the pins the same except for the ones connecting the sonar component. Hopefully this works!

Download the code here:

Link to Week 12 where I complete a successfull input device and additionally write a program to read its output