Introduction: UV Sensor Displayed on LCD Screen Using Arduino
This project uses an Adafruit SI1145 UV/Visible Light/Infrared sensor to calculate the current UV rating. UV isn’t sensed directly. Rather, it is calculated as a function of the visible light and infrared readings. When I tested it outside, it was accurate based on the the UV reading from weather.com. I envisioned the project with a "steampunk" theme - a device that an airship captain would need when the UV exposure on the deck would require application or reapplication of sunblock.
The overall design was intended to integrate with the Raspberry Pi weather station. Unfortunately, I haven't completed that integration yet. I'll update this instructable with further details when that occurs.
Step 1: Gather Necessary Materials
- Arduino Uno and sync cord to USB port
- Computer to program Arduino
- Adafruit Library for the UV sensor (https://github.com/adafruit/Adafruit_SI1145_Library/)
- Liquid Crystal display library (https://github.com/arduino/Arduino/tree/master/libraries/LiquidCrystal)
- LCD display. I used: (https://smile.amazon.com/uxcell-Standard-Character-Backlight-Display/dp/B00EDMMTGY/ref=sr_1_1?ie=UTF8&qid=1481681388&sr=8-1&keywords=lcd+screen+arduino)
- Adafruit SI1145 sensor for UV/IR/visible light (https://www.adafruit.com/products/1777) B
- Male–to–male jumper cables
- 10k Potentiometer
- 220 ohm resistor
- Battery pack (8 AA batteries) 6 AA batteries
Step 2: Configuration of Hardware
Solder UV sensor
Connect Arduino to USB port on computer
Connect LCD display to Arduino
- LCD RS pin – digital pin 12
- LCD Enable pin – digital pin 11
- LCD D4 – digital pin 5
- LCD D5 pin – digital pin 4
- LCD D6 pin – digital pin 3
- LCD D7 pin – digital pin 2
Connect UV sensor module to Arduino. (Adafruit's page on the sensor includes a nice tutorial including wiring pics).
- VIN to power supply – 5V or 3V. I set the sensor to use 3.3V so that the 5V can be used by the LCD screen
- GND to ground.
- SCL on sensor to SCL on Arduino - pin A5.
- SDA on sensor to SDA on Arduino – pin A4.
Wire a 10k potentiometer to +5V and Ground with output to LCD pin 3
Wire a 220 ohm resister to power the backlight of the display, pin 15 to 5V and Pin 16 to Ground.
Step 3: Add Code to Arduino to Take UV Readings
The attached file includes the code for the Arduino which will initialize the sensor and take UV readings.
Step 4: Troubleshooting (if Necessary)
I used battery packs to power the Arduino because a 5V power adapter gave it too much power - the display looked wonky.
You can view the initialization of the sensor from the serial display in the Arduino. A minor tweak in the code can allow you to check readings on the serial display as well. Change "lcd.print" to "serial.print."