9-Input devices¶
Assignments¶
Group assignment:¶
- Measure the power consumption of an output device.
- Document your work on the group work page and reflect on your individual page what you learned.
Individual assignment:¶
- Add an output device to a microcontroller board you’ve designed and program it to do something.
Learning outcomes - Demonstrate workflows used in controlling an output
The road map i made for this week can be accesed here
Individual Assignments¶
This was the Scematic for my first board
Oled¶
While working with the oled, since I needed to use the esp32 library for the xaio board, heres how I downloaded it.
Firstly, go to tools- boards- Board manager
It should bring you too this. Then type esp32 and install it
Once it is installed, to access it you need to go back to tools- boards- esp32. Then look for the esp32 microcontroller you’ll be using.
This is the code I used while testing it with an an arduino and the xaio
/*
Light meter
Oled interfacing with Seeeduino XIAO
Download Libraries:
https://www.electroniclinic.com/arduino-libraries-download-and-projects-they-are-used-in-project-codes/
*/
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// int LDR = A0;
// int LDR_DATA;
// int F_value; // LDR sensor final value
void setup() {
Serial.begin(57600);
// pinMode(LDR, INPUT);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
delay(2000);
display.clearDisplay();
display.setTextColor(WHITE);
}
void loop() {
// F_value = readSensor();
display.clearDisplay();
// display R G B Values
display.setTextSize(2);
display.setCursor(0,0);
display.print("L Meter:");
// display.setTextSize(3);
// display.setCursor(0, 28);
// display.print(F_value);
display.setTextSize(1);
display.setCursor(0, 56);
display.print("www.electroniclinic.com");
display.display();
}
// int readSensor()
// {
// LDR_DATA = analogRead(LDR);
// LDR_DATA = map(LDR_DATA,0,1023,0,100);
// return(LDR_DATA);
// delay(1000);
// }
Afterwards, It worked with bothe the arduino and xaio, but it didnt work with my microcontroller, so I decided to make it again
Errors¶
1- The first error I faced was checking the power with a multimeter. The first few times the connection wa sjust not done right, but afterwards, even if i got the connection correct, it turned out that it just short circuited, so i needed to make a new microcontroller.
2- During the connection process, i also, like i mentioned made quite a few wrong connections, so i burned up the oled.It didn’t exactly burn, it just heated up but i felt liek i should mention it in my errors.
3-