Skip to content

Input Devices

Group assignment

  • Probe an input device(s)’s analog levels and digital signals

  • Document your work on the group work page and reflect on your individual page what you learned

Individual assignment

  • Measure something: add a sensor to a microcontroller board that you have designed and read it.

Learning outcomes

  • Demonstrate workflows used in sensing something with input device(s) and MCU board

Have you answered these questions?

  • Linked to the group assignment page.

  • Documented what you learned from interfacing an input device(s) to your microcontroller and optionally, how the physical property relates to the measured results.

  • Documented your design and fabrication process or linked to the board you made in a previous assignment.

  • Explained the programming process(es) you used.

  • Explained any problems you encountered and how you fixed them.

  • Included original design files and source code.

  • Included a ‘hero shot’ of your board.


Time Management

You can access my timetable here.


Group Assignment

You can access the link to our group assignment page here.


Reflection


Individual Assignment

For this week’s assignment, we needed to add a sensor to a microcontroller board that I have designed and measure something with the sensor. For this, I initially thought of adding an RFID module to the microcontroller board that I had designed last week.


RFID module

The RFID module I am going to be using is the RC522 module.

Image source

For reference, this is what my board to which I connnected my RFID module looks like:

Tap here to get more details on the board I am using.

Arduino IDE

Open your Arduino IDE and make sure to download the library of your sensor.

Downloading library

Go to Sketch > Include Library > Manage Libraries.

Install your required library.

Trying out an Example Code

To test my board and my RFID module, I decided to try an example code.

Go to File > Example > MFRC522 > Dumpinfo

This code is supposed to display the ID of the RFID card you scan to the reader in the serial monitor.

Verify and upload your code after connecting your board to your laptop. After that is done, open the serial monitor. Go to, Tools > Serial Monitor.

Error

This is what my serial monitor displayed after verifying and uploading my code.

Firmware Version: 0x0 = (unknown)
WARNING: Communication failure, is the MFRC522 properly connected?
Scan PICC to see UID, SAK, type, and data blocks...

I intially thought that there was something worng with my board, so I switched to an Arduino UNO. I made sure the Arduino Board works by trying the blink code on it. However, it gave me the same results. I then concluded that there was something wrong with my RFID module😔💔

This is the link I used to connect my RFID reader with my Arduino (which did not work in the end but it should still work for working RFID cards).


Tsheyang-duino

Rico-san suggested us to redesign our personal development board to make it more generic instead of just making it for a single purpose, like we did last time. So, I started working on that.

I opened Kicad and this is my schematic design.

This is my first pcb design which turned out not so good. Rico suggested me not to place the pin headers above the USB slot of my Xiao.

Therefore, I moved the 2 components above the USB slot to the side.

I adjusted a few things, and this is how the final result turned out!

I soldered it and this is how it turned out!(I did not solder the LEDs yet because I was too lazy).

I will now be trying out the input sensors with my new board.


Sound Detector

Now, let’s try a sound detector which should be fun. Normally, a sound detector should have 3 types of outputs it can provide you with- analog, envelope, and digital. The analog output gives the actual waveform of the sound, whereas the digital output turns HIGH when a sound above a certain level is detected. I will be working with the envelope output which provides us with an output that follows the loudness of a sound. This is useful when you want to detect the loudness of a sound.

To get started, I went through this tutorial.

I tried with an Arduino UNO and it worked! This confirmed that my code and my sensor works just fine.

Time to switch to my board. This is how it looks.

Here is the connections I made with the sensor and my board.

Sensor Board
VCC 5V
GND GND
Signal pin A0

Code Explaination

This is the code I used. I got it from the above link.

#define envelopePin A0

void setup() {
  Serial.begin(9600);
  pinMode(envelopePin, INPUT);
}

void loop() {
  Serial.println(analogRead(envelopePin));
  delay(500); 
}

Explanation of the code

The code starts off by defining the pin A0 where the sound detector’s envelope output is connected. The void setup() functions starts the serial communication and sets the envelope pin as the input. In the void loop() function, it reads the sound level and prints it to the Serial Monitor every half a second.

Results

Here are the results.

As you can see, when I shouted(not exactly shout) near the sensor, the numbers went up.

Original Design Files


Thank you!

The template for this website was provided by Mr. Anith Ghalley and used with his permission


Last update: April 24, 2025