Add a sensor to a microcontroller board that you have designed and read it
For this week's assignment I made the hello.HC-SR04 board
BOM
ATtiny45 microcontroller
1uF capacitor
10K resistor
6-pin ISP header
FTDI header
2x2 pin header
As usual I started designing it on Eagle
I only changed the pin header using a 2x2 to connect the sensor (HC-SR04 V1.0)
After soldered and connected the board to my FabISP I started to program. Before to do this I downloaded Neil's C code and .make file adjusting it to my project
When I moved to type the make-program I recieved an error
But I only had to repeat the command and it worked
I didn't set the fuses because this time I didn't use an external clock as I did in my previous boards, but the ATtiny45 internal clock (8MHz)
Before this week I didn't know what Python was, so I needed to read something about it
My instructor suggested me this tutorial wich was foundamental. And with a big help of my classmate Simone I've been able to get the job done
First thing I downloaded Neil's python file and I made it executable by typing the command in my terminal
But when I moved to launch it I recieved an error...
The command is not found because I typed "./" as a link to the current folder, but in the .py file there wasn't the line wich defines that file as a python
Then I added that line on the top (the first blu line in the document)
Otherwise I could type the command "python dist_sensor.py" without that line and it would work well
But when I repeated the command I recieved another error...
The message ask to install the python-tk package. So I did it
Then I had to find the serial port wich the FTDI was connected...
...because when I tried to launch the python file I recieved a notification that told me that the right command to type includes the serial port
And also another one that asked for superior permission
Finally I was able to launch the python file and then to recieve a visual feedback of the device working
Eagle and programming files here
This work is licensed under a Creative Commons Attribution - ShareAlike 4.0 International License