Input Devices

This week we got to work with input devices. The official assignment was to measure something by adding a sensor to our microcontroller board. After careful deliberation, I decided to add a Hall Effect sensor to my board from week 6.

All boards closeup

For our design this week we again used Autodesk EAGLE with Fusion 360. There wasn't too much we had to change from our previous schematic design to add the Hall effect sensor. There are three pins on the sensor. One for GND, one for output, and one for power. Different makes and models could have different positionings of these pins, so it is important to check the documentation. Our final schematic and PCB design looks like this:

schematic
pcb

Soldering this board is not particularly challenging. The only new part here is the Hall Effect Sensor. That was a bit tricky to solder as this version of the part had very long pins. In retrospect, we could have clipped those pins, but this time around we just soldered the part onto the board out of the box. The key thing to remember is that the pins does not necessarily have to be soldered onto the pad, but can be soldered anywhere on the same wire. Using this trick, we produced the board:

final board 1
final board 2

For programming the board, we used a similar setup as the previous time. Since we worked with an ATTiny, that meant there was no need for a bootloader program being fed into the microcontroller. To test out the sensor, we first tried programming the light to turn on when receiving a HIGH read from the sensor, and to turn off when receiving a LOW read. The video of that experiment is include below:

Of course, it turns out that this is an analog sensor, which means we need to be performing analog reads. Making this adjustment, we found a threshold around 520 to be working decently well. Our new program works as follows. When the button is pressed, the light turns HIGH, and when an analog read from the Hall Effect sensor is larger than 520, the light blinks. Here is the Arduino code for this experiment and the code in action:

Link to index page