12. Output devices¶
Goal(s):
- Individual assignment:
-
Add an output device to a microcontroller board you’ve designed, and program it to do something
-
Group assignment:
- Measure the power consumption of an output device
Introduction¶
This is week assignment is to make a microcontroller board which can be used to contol an output device. There are different type of output devices are available like LED, Speakers,LED arrays, RGB LED, LCD,OLED,Servo & steppr motors etc. I have decided to use the same Satshakit board to interface with LCD display. After going through the details of the project, I was able to finalize that I wanted to use a simple LCD display and for the Microcontroller, I decided to use the Satshakit by Danielle Ingrassia
Signal testing¶
I initially used Arduino UNO Boards to test the waveforms and signals to understand how the board and then progress to The Satshakit boards which is prgrammed using Arduino as an ISP.
As per the previous week’s assignment, the input sensor was connected to the the Satshakit Micro and the the output sensor used was the LCD Screen with a 4-pin I2C module that greatly simplifies the wiring of the LCD from 16 pins to 4 pins.
For this assignment, I used the same Satshakit Micro to test the output to a 4-pin LCD screen which I will be using in my Final project.
LCD Output
Square digital signals
Similarity to the Input exercise¶
As this exercise was similar in function to the Input Devices exercise, all the documentation for output can be referenced from the previous page as this exercise was done to understand the fundamentals of the Electronics control and design exercises.
Final Board¶
Codes used¶
Code used
#include <LiquidCrystal_I2C.h> #include <OneWire.h> #include <DallasTemperature.h> LiquidCrystal_I2C lcd(0x27,20,4); OneWire ds(2); void setup() { lcd.init(); lcd.backlight(); lcd.print("Temperature....."); delay(3000); lcd.clear(); lcd.print("Starting....."); delay(3000); } void loop() { byte i; byte present = 0; byte type_s; byte data[12]; byte addr[8]; float celsius, fahrenheit; if ( !ds.search(addr)) { ds.reset_search(); delay(250); return; } for ( i = 0; i < 8; i++) { } if (OneWire::crc8(addr, 7) != addr[7]) { return; } // the first ROM byte indicates which chip switch (addr[0]) { case 0x10: type_s = 1; break; case 0x28: type_s = 0; break; case 0x22: type_s = 0; break; default: return; } ds.reset(); ds.select(addr); ds.write(0x44, 1); // start conversion, with parasite power on at the end delay(1000); // maybe 750ms is enough, maybe not // we might do a ds.depower() here, but the reset will take care of it. present = ds.reset(); ds.select(addr); ds.write(0xBE); // Read Scratchpad for ( i = 0; i < 9; i++) { // we need 9 bytes data[i] = ds.read(); } int16_t raw = (data[1] << 8) | data[0]; if (type_s) { raw = raw << 3; // 9 bit resolution default if (data[7] == 0x10) { // "count remain" gives full 12 bit resolution raw = (raw & 0xFFF0) + 12 - data[6]; } } else { byte cfg = (data[4] & 0x60); // at lower res, the low bits are undefined, so let's zero them if (cfg == 0x00) raw = raw & ~7; // 9 bit resolution, 93.75 ms else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms //// default is 12 bit resolution, 750 ms conversion time } celsius = (float)raw / 16.0; fahrenheit = celsius * 1.8 + 32.0; delay(300); lcd.clear(); lcd.setCursor(0,0); lcd.print("ICEICE BABY TEMP"); lcd.setCursor(0,1); lcd.print(celsius); lcd.print("C:"); lcd.setCursor(2,1); //lcd.print(set_temperature,1); lcd.setCursor(9,1); lcd.print(fahrenheit); lcd.print("F:"); lcd.setCursor(11,1); // lcd.print(temperature_read,1); }
Learning¶
This exercise has much to learn and much to assimilate from the FabLab Point of view. I realise that, if I should qualify for instruction, the mode of learning Electronics and also teaching of electronics has to be simplified to the point of child-like ease as I discuss and learn the enornmous complexities of teaching electronics, as there are multiple mental blocks and fear among other students that prevent them from actively learning and taking up Electronics later in their career.