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, demonstrating analogue input and output control.
Core Principles
- Microcontrollers can read analogue signals from sensors.
- Photoresistors (LDRs) vary resistance based on light intensity.
- TMP36 temperature sensors provide analogue voltage output proportional to temperature.
- Arduino's analogue inputs (A0-A6) read signals between 0 and 1023.
- Voltage dividers are used to create a measurable signal for microcontrollers.
- Block programming (like in Tinkercad) simplifies circuit simulation and code development.
- Mapping sensor values to output ranges (e.g., LED brightness, LED states) is a common application.
- Resistors are crucial components for controlling current and voltage in circuits.
Action Steps
- Connect Arduino to PC via USB.
- Create virtual circuits on Tinkercad, ensuring correct wiring.
- Add/remove components in Tinkercad.
- Correctly connect components using a breadboard.
- Select appropriate Arduino pins for component connection.
- Develop simple block programs and simulate circuits.
- Understand the difference between analogue and digital input signals.
- Build a light-sensitive lamp using a photoresistor, LED, and resistors.
- Build a thermometer system using a TMP36 sensor and LEDs.
- Map sensor readings to control output devices (e.g., LED brightness or state).
Formulas
- Voltage Divider: $V_{out} = V_{in} \times \frac{R_2}{R_1 + R_2}$
- Temperature Conversion (Celsius to Fahrenheit): $F = (C \times \frac{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.
- Analogue Input: An input pin on a microcontroller that can read a continuously variable signal, typically voltage.
- Digital Input: An input pin that reads a signal as either HIGH (on) or LOW (off).
- Breadboard: A construction base for prototyping electronics, used to build circuits without soldering.
- Tinkercad: A free, easy-to-use, cloud-based 3D design and 3D printing application.
- Voltage Divider: A simple circuit that divides a voltage into a smaller voltage, often used to interface sensors with microcontrollers.
- TMP36: An analogue temperature sensor that outputs a voltage proportional to the temperature.
- Resistor: An electronic component that resists the flow of electric current.
Pro Tips
- Always double-check wiring in Tinkercad before simulating.
- Use the serial monitor to understand sensor readings and debug code.
- The `map()` function is essential for scaling sensor values to control outputs.
- Ensure correct identification of components like transistors vs. sensors.
- Consider using different resistor values to fine-tune circuit behaviour.
Pitfalls to Avoid
- Incorrect wiring can lead to simulation errors or component damage.
- Confusing analogue and digital pins on the Arduino.
- Misinterpreting resistor colour codes, leading to incorrect resistance values.
- Not using a voltage divider for sensors like photoresistors and temperature sensors.
- Assuming components are identical when they are not (e.g., TMP36 vs. NPN transistor).
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 to measure ambient temperature and display it.
- Smart home lighting that adjusts brightness based on ambient light.: Combines photoresistors with microcontrollers to control LED brightness.
Timeline
- Week 3a: Basic Arduino connection, Tinkercad simulation, analogue vs. digital signals, use of LEDs, potentiometers, pushbuttons.
- Week 3b (Part 1): Expanding applications: Building a light-sensitive lamp using a photoresistor.
- Week 3b (Part 1): Learning to read photoresistor values and map them to LED output.
- Week 3b (Part 1): Introduction to resistor colour codes and voltage dividers.
- Week 3b (Part 1): Building a thermometer system using a TMP36 temperature sensor.
- Week 3b (Part 1): Programming LED indicators for different temperature thresholds.
People
- Arduino: Open-source electronics platform and microcontroller board.
- TMP36: Specific model of analogue temperature sensor.
More like this