Giter Site home page Giter Site logo

admacpherson / pico-daylight Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 288 KB

This repository hosts the files for a Raspberry Pi Pico Daylight Alarm - created Spring 2022 by Andrew Macpherson, Mark Clemmer, Ebby Buchta (Rensink), and Handrae Henthorn

Python 100.00%
python daylight esp8266 led-strips micropython raspberry-pi raspberry-pi-pico alarm-clock oled potentiometer

pico-daylight's Introduction

Pico-Daylight

Description

This repository hosts the files for our Raspberry Pi Pico project for a Daylight Alarm. The system is designed to help one's circadian rhythm more in sync with the natural daylight cycle by mimicking natural light throughout the day. The brightness of the light can be controlled at any time by the user using a dial, which is a potentiometer that scales the user's input to adjust the brightness of the lights on a 0 - 100 scale. The project also has a built in alarm that can wake the user up using soft simulated sunlight that gradually gets brighter. At the end of the wake-up sequence a buzzer is programmed to sound so that the user is sure to be woken. The alarm can be configured to go off at any time, and is able to be turned off for days that you just want to use the clock features. The system has an LCD that displays the currentlocal time, which it fetches using an Internet connection, provided by an ESP8266-01 Wifi Module.

The neopixel.py library is required to get the LED strip working, and the RGB1602.py library is used to get the LCD display working.

Features: LED Simulated Daylight, LED Alarm, Buzzer Alarm, OLED, WiFi Connection, Adjustable Brightness

Authors

Andrew Macpherson (@admacpherson)
Mark Clemmer (@mclemmer7)
Ebby Buchta (@ebbyy)
Handrae Henthorn

ESP 8266-01 Documentation

To get the current time for the alarm clock, our project uses an ESP8266-01 Wifi module to connect to the Internet and the MicroPython utime library to fetch the present time.

Wiring

The wiring of the ESP8266-01 to the Raspberry Pi Pico is as follows:

ESP ........... Pico
3v3 ........... 3v3 (via breadboard positive rail)
RST ........... N/A
EN ........... 3v3 (via breadboard positive rail)
TX ........... GP0
RX ........... GP1
IG1 ........... N/A
IG2 ........... N/A
GND ........... GND (optional via breadboard negative rail)

Software

Prerequisite: MicroPython for Raspberry Pi Pico must be installed on the device. Our version (rp2-pico-20230426-v1.20.0.uf2) is available in the repository.

Our program uses a modified version of Noyel Seth's (@noyelseth) rpi-pico-micropython-esp8266-lib. Many thanks to @MladenSU for their crucial pull request that fixes fatal errors.

The esp8266time.py file contains three main sections

  1. HTTP Parser Class
  2. ESP 8266 Class
  3. Main Program

The main program first sets up the ESP8266-01 module as an instantiated Python object, then connects to the local Wifi network given the username and password, and finally gets and returns the local time.

Instantiating the ESP8266 object: The esp8266.py class contains a default class constructor: def __init__(self, uartPort=0, baudRate=115200, txPin=(0), rxPin=(1)). Before changing the TX and RX pins, consult the Raspberry Pi Pico documentation to ensure that the UART port does not also need to be changed.

Screenshot 2023-06-06 at 11 02 01 AM

Special Consideration - WiFi Captive Portal: Our primary workspace was located on-campus at Seattle Pacific University. Accordingly, we relied largely on campus WiFi which does not use traditional WPA-2 encryption as is found on many home and business networks. Instead, SPU relies on a captive portal which allows any user to join the network with a simple username and password but does not provide Internet connection until the user is authenticated via a login to an SPU webpage. Obviously the Pico is not a browser device so to account for this we followed the instructions of the CIS Helpdesk at SPU, which require opening a port for the device based on its MAC address. To do this, we connected the ESP8266-01 to CoolTerm and performed the following process:

  1. Configure settings
    a. Ensure correct port is selected
    b. Set Baudrate: 115200
    c. Enable line mode via Settings > Terminal Options > Line Mode
  2. Ensure the ESP8266-01 is properly connected by sending AT via the terminal
    a. A response of "OK" means it is working
    b. Anything else means the module is not properly connected
  3. Set station mode with AT+CWMODE=1
  4. Get MAC address with AT+CIPSTAMAC?
  5. Optional: The WiFi can be connected directly via terminal using AT+CWJAP=“SSID”,”Password” (include quotes)

pico-daylight's People

Contributors

admacpherson avatar mclemmer7 avatar

Watchers

 avatar  avatar

Forkers

mclemmer7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.