In this chapter, we learn to:
program EDU PICO V2 to read analog values from a potentiometer.
measure noise in dB with the PDM sound sensor.
construct a physical noise level meter with a card accessory.
Introduction: Potentiometer and PDM Sound Sensor.
AI Task #1: Use the potentiometer to control the brightness of the RGB LED strip.
AI Task #2: Use the sound sensor to turn the LED on and off when the sound level exceeds a specific threshold.
Activities: Build a room environment noise pollution monitoring system.
Challenge: Program a servo motor to serve as a sound level meter.
In this lesson, you will learn to interpret analog signal voltage while manipulating a variable resistor or a potentiometer (pot). This is also one of the more popular projects created for beginners to learn how to control electrical output by using a simple analog input device.
-> Libraries: board, time, AnalogIn.
-> Potentiometer Configuration: GP28 with analog input.
-> Input:
Turning the potentiometer knob will alter the output flow of electricity.
Turning the knob clockwise will increase the voltage, and anti-clockwise will reduce the voltage.
Upon completion the activity, you should be able to:
-> Continuously reads the voltage from analog pin GP28 (connected to the EDU PICO V2 potentiometer).
-> Display the voltage value to the shell console at an interval of 0.1 second.
Task:
-> Use the potentiometer to control the brightness of the RGB LED strip.
Upon completion of the activity, you should be able to:
-> See turning the potentiometer clockwise should increase the LED brightness and anti-clockwise to reduce the LED brightness. All the LEDs should like up pink in colour.
A PDM microphone, or Pulse-Density Modulation microphone, is a type of microphone that converts sound waves into a digital signal. Unlike our traditional microphones that use analog signals, the digital signals produced by PDM microphones are more resistant to noisy environments, making them ideal for applications such as smart home voice commands, noise level monitoring, or even sound analysis.
-> Libraries: board, time, array, math, audiobusio
-> PDM microphone configuration: Data (DAT) = GP2, Clock (CLK) = GP3.
Upon completion of the activity, you should be able to:
-> The sensor will measure sound level in voltage (magnitude) and convert it to sound level in decibels (dB).
-> If the magnitude is greater than 0, the code prints the sound level in decibels (dB) at the shell console with an interval of 0.1 second.
-> If the magnitude is less than 0, the code prints "Magnitude is too small to calculate dB" at the shell console.
Task:
-> Use the sound sensor to trigger an LED On and Off when the sound level exceeds a set threshold (like clapping or loud noise).
Upon completion of the activity:
-> Try clapping or make a loud sound near the microphone, the LED should turn ON. When quiet, the light should turn off.
Noise pollution is a critical issue that often goes unnoticed in our ever-expanding urban society, ultimately affecting our overall well-being and quality of life. Fortunately, we can address this problem with the help of PDM microphone and EDU PICO V2. By learning how to use these tools, we can effectively measure and analyze the noise levels in our environment. Through this section, we will program a fully functional noise monitoring system that allows users to input an acceptable noise limit. In no time, you 'll be able to deploy your EDU PICO V2 for accurate noise measurement in your classroom or local library!
-> Libraries: board, time, analogIn, neopixel, busio, array, audiobusio, math, adafruit_ssd1306.
-> PDM Microphone Configuration: GP2 and GP3.
-> OLED I2C Configuration: SCL = GP5 and SDA = GP4.
-> Potentiometer Configuration: GP28 with analog input.
-> Input:
Ambient noise (The louder the noise, the higher the decibel (dB)).
Adjust potentiometer value to adjust noise threshold.
Upon completion of the activity, you should be able to:
-> If noise received from PDM microphone exceeds the threshold value set by the potentiometer, the RGB LEDs will light up in red, indicating the space is too noisy.
-> If noise is below the threshold, RGB LEDs will light up in green, indicating a safe noise level.