Input Devices¶
Scheduling¶
As per usual, I started off my week by planning out my schedule.
Individual Assignment¶
I’m going to stick to KiCad for this week too. Since I’m not changing much about my design.
KiCad¶
“KiCad is a free and open-source electronics design automation (EDA) suite. It features schematic capture, integrated circuit simulation, printed circuit board (PCB) layout, 3D rendering, and plotting/data export to numerous formats. KiCad also includes a high-quality component library featuring thousands of symbols, footprints, and 3D models. KiCad has minimal system requirements and runs on Linux, Windows, and macOS.”
I already brought up and introduced KiCad in the past weeks, so you can check out my documentation for those weeks on my page, however, I’m including this cheat sheet (again) so that you can refer to it when you’re working on your own design.
Name | Shortcut | Symbol Location | Function | Symbol |
---|---|---|---|---|
Select item | S | Schematic Editor | Selects an item in the schematic editor | |
Add a symbol | A | Schematic Editor | Adds a new component to the schematic | |
Add a power symbol | P | Schematic Editor | Adds a power symbol to the schematic | |
Add a wire | W | Schematic Editor | Adds a wire for electrical connection | |
Add a no-connection flag | Q | Schematic Editor | Adds a no-connection flag to indicate no electrical connection | |
Add a junction | J | Schematic Editor | Adds a junction where two wires meet | |
Add a global label | CTRL+L | Schematic Editor | Adds a global label to identify a net or signal | |
Plot | N/A | Schematic Editor | Plots the schematic into a file format | |
Schematic setup | N/A | Schematic Editor | Sets up the schematic properties | |
Electrical Rules Checker | N/A | Schematic Editor | Checks the schematic for any electrical rule violations |
The Design Process¶
My Microcontroller¶
Since I’m using the XIAO ESP32C3, not much has changed with my overall design. I’ve documented the design process in the past in detail, and this week was essentially the same, so you can check out my Electronics Design and Output Device pages for a better understanding of the general process.
This is the diagram that I referred to religiously, as well as some more information from the official page.
Specifications¶
Item | Value |
---|---|
CPU | Xtensa®single-core 32-bit LX7 microprocessor, up to 160 MHz |
Flash Memory | 4MB |
SRAM | 400 KB |
Digital I/O Pins | 11 |
Analog I/O Pins | 4 |
PWM Pins | 11 |
I2C interface | 1 |
SPI interface | 1 |
Power supply and downloading interface | Micro USB |
Power | 3.3V |
Dimensions | 20×17.5×3.5mm |
The Schematic Layout¶
Not much has changed from the output devices week, however, I did include the pins to connect to the main input device that I have in mind: The PN532 NFC RFID Module.
I made sure to utilize tags, and no-connection flags.
The PCB Editor¶
I selected my “edge” material and then used the circle tool (at 0.6mm). For this week, my power lines were 0.6mm and my signal lines were 0.4mm.
I didn’t include my microcontroller footprint in the final export because I’ll be connecting it to the 1x07 connection sockets.
Final Result¶
This is how the board came out !!!
The HC-SR04¶
The HC-SR04 is an ultrasonic distance sensor module commonly used in electronics projects to measure distances accurately by emitting ultrasonic waves and calculating the time taken for the waves to bounce back.
I remember making a motion sensor lamp for my Pre Fab project, and I wanted to see if I could recreate that using this. I started off by opening Arduino IDE and downloading the >< library.
Then, I modified the code that I used during my Pre Fab project, and the results came out pretty well.
This is the code that I used. I generated it using ChatGPT, and it’s supposed to change the brightness of the LED based on the distance value that the ultransonic sensor reads:
#include <Ultrasonic.h>
const int trigPin = 7;
const int echoPin = 6;
const int lampPin = 5;
const int HELLOLED = 2;
Ultrasonic ultrasonic(trigPin, echoPin);
void setup() {
pinMode(lampPin, OUTPUT);
pinMode(HELLOLED, OUTPUT);
digitalWrite(HELLOLED, HIGH); // Turn on the LED connected to pin 2
}
void loop() {
int distance = ultrasonic.read();
int brightness = constrain(map(distance, 2, 200, 255, 0), 0, 255);
analogWrite(lampPin, brightness);
delay(100);
}
You can’t see it very well in the video, but the LED does change brightness based on the distance value on the serial monitor (I included the highest and lowest brightness levels in this GIF).
DHT11 Sensor¶
The DHT11 sensor is a basic digital temperature and humidity sensor module widely used in electronics projects to measure ambient temperature and relative humidity with a pretty low cost and moderate accuracy.
I installed the DHT sensor library by Adafruit, and then opened a test file from under the “examples” tab.
I got this code from ChatGPT (again), it’s supposed to measure the moisture and temperature in the immediate area and update the values on the serial monitor.
#include <DHT.h>
#define DHTPIN 7 // GPIO pin to which the DHT11 sensor is connected
#define DHTTYPE DHT11 // DHT sensor type
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(1000); // Wait a few seconds between measurements
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("%\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("°C");
}
as you can see, when Yeshey breathes on the sensor, the serial monitor updates the information quite quickly
Reflection¶
This week was pretty fun icl. It was really interesting to see how my board actually worked (I’ve definitely getting more confident), and I’ve definitely learned how to interface input devices with the rest of my project. I feel that this is the board I’m going to stick to for my final project.
- Wozer
Renders¶
Composite | Traces | Interior |
---|---|---|
click on the PNG render to access the SVG version on my remote repository for downloading !!!
This website was created using a template provided by Mr. Anith Ghalley and was used with his permission.*