10. Input devices
Back home finally from the hospital. Looking back, it has been just about three weeks mostly off Fab Academy... That's a lot, so I will have to do my best keeping the fast pace that the course is taking. I was really looking forward this week, since during it I will have the chance to finally test at least one measuring device, which I need for my final project. I will start the first spiral with one ulrasonic module, using the AT Tiny 45, and then move up to a ToF sensor, using a AT Tiny 1614. If I have extra time, I would like to use a photodetector to set some sort of pattern in the rail, sensitive to light, so I can trigger the distance measuring at predetermined intervals.
Hi-Sonar
I will start this week first iteration by using the hello.HC-SR04. I will make minor modifications in the design, so I get some more practice time with Kicad. I will rename the project to hi-sonar.
Here is a screenshot of the schematic. I used tags for both TISO and TOSI nets, to keep it somehow readable. I still could not fully understand why there is a 1uF capacitor between Vcc and GND, so I read through this tutorial by sparkfun, and found out that it is to filter noise that could cause malfunction in the circuit. Then I remembered that it was explained by local instructors in previous weeks. As for the 10k resistor, my guess at this time is that it is a pull up resistor for the RST in the ISP.
After the schematic was done, routing the traces was quite fun. I have to admit that I really like solving this sudoku like mazes. Again, assigning different colors to each nest is a really handy feature in Kicad nightly build.
Then, the everyweek a bit more familiar workflow: retouch and sign in Inkscape, export png's and get g-code files for both traces and outline, using mods.
Kicad and svg files for hi-sonarI used the already familiar settings for the milling: feedrate 6 mm/sec, 18k rpm and 0.1 mm pass depth, for the 0.4 mm endmill, and the same settings, but 0.25 pass depth for the 0.8mm end mill:
Before milling this board, I was finally able to finish the universal vacuum hold down system... it had been halted since week 8, but it seems ages, with all that has happened to me... I was quite pleased with this outcome:
When I was going to start stuffing the pcb, I wanted to make sure that all measures were ok. In the previous weeks, I had always had a bit of a hard time soldering the AT Tiny 45, and having a close look, it seems to me that the pads for this part are a little bit too short. As soon as I find time, I will modify it in Kicad and test if the soldering gets any easier.
Soldering is still a skill that I have to practice. But I can already tell the difference both in confidence and ease, specially with the smd 1206 parts, which I used to see as so tiny as barely manageable, and now they seem huge to me.
The part that was new to me this week was the 4 pin female header, to hook-up the SR-04 sonar component. I only have available full rows of 20 pin headers, so I had to cut it from one of them. I found out that it was not possible to cut directly the desired number of pins, because the plastic wall between adjacent pins is really thin. So in the second try, I just cut one more pin, removed the metal connector, and then filed the edges.
Finally, after some struggles with the flow of soldering, I got the board finished. Once I took the picture, I noticed that one of the ISP pins was not correctly soldered. I tested continuity between pins and pads, and evertything seemed fine
I am aware that I am by no means done with this week assignment: I know I did not even complete the bare minimum. But, this time, instead of being mad, I am extremely happy, because at least, I was able to get some work done. I am really looking forward to fully recover and get back to the fast pace of the class, which, by the way, I was really enjoying a lot.
Once recovered
In the following weeks I finally did fully recover, and could finish this assignment. Not only that, I also built another board for another distance sensor, the VL53L1X, and managed to get both of them working.
First thing I did was use Neil's code and python programs for the sonar distance sensor. What this sensor does is to send an ultrasonic sound that bounces off whatever object it reaches, and listens back to it. That way it is able to set the distance. Accuracy is in the order of magnitude of the centimeter, and the mai problem is when the object where the sound waves bounces off is not perpendicular to the direction of the waves: it easily looses track.
Something I noticed is that somehow my phone was able to record the ultrasound, change its frequency so a pulsed noise can be listened to:
During networking & communications week I also made another board, at first for using it during that week. I finally did not use it for communications, but I was able to read from the sensor, a time of flight VL53L1X. This other distance sensor sends a laser beam, that bounces off the object in the range, and reads back its reflection. What is truly amazing is that considering speed of light is 300.000 km/s, the order of magnitude of the time measured is really small...
I also used Neil's programs to read the data from the sensor. At first, I was a bit confused because the incomming data was not readable:
But after quite a few debugging sessions, I learnt that the problem was how was Neil sending the data, and that his Python program was interpreting it just fine.
And the accuracy of this sensor is much better than the one of the sonar, in the order of magnitude of just a few millimeters. Also, the range can go up to 4 meters. The drawback I have so far found is that it is a bit sentitive to different lighting conditions. Anyway, definetly is the sensor that I am going to use for my final project.
Group assignment: probe an input device signals
Again alone for the group assignment... This time, I probed digital signals from the sonar HC-SR04. I used my pocket oscylloscope, plugged the white probe to Echo and the black to ground, and wathed the shape of the signal:
I had to adjust both voltage and timing, to clearly see the signal. And when I moved the object to which it was measuring distance, the signal changed in amplitude:
The SR-HC04 is an input device which has itself three microcontrollers. For now, I do not have the skills to tell which of the pins of those microcontrollers are getting analog readings, so I just tested a few of them, and found two that had irregular shapes in the waves, that changed when moving the sensor:
As a conclusion, it is quite interesting to see how something both analog and physical gets converted into something digital. And by varying the amplitude of the digital signal, the device is able to tell to the microcontroller how far another object is.