Expanding Microcontroller Applications
This cheat sheet covers expanding microcontroller applications by building a light-sensitive lamp using a photoresistor and a thermometer system using a TMP36 temperature sensor, both with Arduino.
Core Principles
- Microcontrollers can read analog signals from sensors.
- Photoresistors (LDRs) change resistance based on light intensity.
- TMP36 temperature sensors provide analog voltage output related to temperature.
- Arduino's analog input pins (A0-A6) read signals between 0 and 1023.
- Voltage dividers are used to create a measurable signal for microcontrollers.
- Code can map sensor readings to control outputs like LED brightness or status.
- Resistors have color bands indicating their resistance value and tolerance.
- Block programming (like in Tinkercad) simplifies microcontroller coding.
Action Steps
- Connect Arduino to PC via USB.
- Build virtual circuits on Tinkercad, ensuring correct wiring.
- Add/remove components in Tinkercad.
- Connect components to Arduino using correct pins.
- Develop simple block programs for simulation.
- Understand the difference between analog and digital input signals.
- Use LEDs, potentiometers, and pushbuttons.
- Wire a photoresistor with a resistor to form a voltage divider.
- Program Arduino to read the photoresistor and control an LED's brightness.
- Swap photoresistor for a TMP36 temperature sensor.
- Program Arduino to read temperature and control multiple LEDs based on thresholds.
Formulas
- Analog Read Value: 0-1023
- Temperature in Celsius (TMP36): (analog_read_value * 3.04 / 1000) - 40
- Temperature in Fahrenheit: (celsius * 9/5) + 32
Key Terms
- Microcontroller: A small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals.
- Photoresistor (LDR): A light-dependent resistor whose resistance decreases with increasing incident light intensity.
- Arduino: An open-source electronics platform based on easy-to-use hardware and software.
- Tinkercad: A free, easy-to-use CAD design tool and 3D digital inventory for makers.
- Analog Input: Input pins on a microcontroller that can read a continuously variable range of voltages.
- Digital Input: Input pins on a microcontroller that read discrete states, typically HIGH (1) or LOW (0).
- Voltage Divider: A simple circuit that divides a voltage into a smaller fraction, often used to interface sensors with microcontrollers.
- TMP36: An analog temperature sensor that outputs a voltage proportional to the temperature.
- Resistor Color Code: A system of colored bands on a resistor used to indicate its resistance value and tolerance.
Pro Tips
- Always double-check wiring in Tinkercad before simulating.
- Use the serial monitor to understand sensor readings and program behavior.
- Map sensor values to a desired output range (e.g., 0-255 for LED brightness).
- Ensure the TMP36 sensor is correctly identified; it looks similar to an NPN transistor.
- Use comments in your code to explain different sections.
Pitfalls to Avoid
- Incorrect wiring can lead to simulation errors or hardware damage.
- Confusing analog and digital pins on the Arduino.
- Misinterpreting resistor color codes.
- Assuming a component is a temperature sensor when it's a transistor.
- Not using a voltage divider circuit for analog sensors like photoresistors.
Real World Examples
- Streetlights that turn on automatically at dusk.: Uses a photoresistor to detect low light levels and activate the light.
- A digital thermometer displaying room temperature.: Uses a temperature sensor like the TMP36 connected to a microcontroller.
- Smart home lighting that adjusts based on ambient light.: Combines light sensors with microcontrollers to control light intensity.
Timeline
- Week 3a: Basic Arduino connection, Tinkercad circuits, analog vs. digital signals, LEDs, potentiometers, pushbuttons.
- Week 3b (Part 1): Expanding applications: Light-Sensitive Lamp using Photoresistor.
- Week 3b (Part 2 - implied): Expanding applications: Thermometer System using TMP36 sensor.
People
- WIU (Western Illinois University): Institution providing the Engineering Exploration Project.
Quiz
- What type of signal does an Arduino analog input pin read?: Analog
- A photoresistor's resistance increases as light intensity...: Decreases
- Which component outputs a voltage proportional to temperature?: TMP36 Temperature Sensor
More like this