Git Product home page Git Product logo

led_lamp_fw's Introduction

LED LAMP

LED lamp is a small project that started with the idea of adding more functionalities for my book lamp. It happened that I bought a led lamp with only one light intensity for each led color ( there was warm and cold white ) and it actually was too strong for reading and therefore I needed a lighter intensity. Then I came up with the idea of replacing the controller of the book lamp with a small microchip microcontroller which was pin to pin compatible.

I shared more here

The Hardware

The book lamp is a battery powered device with

  • one tactile button for interface.
  • 2 sets of led: WARM light and WHITE light

How was the book lamp before ?

Everytime the button was pressed the lamp changed its state between: System Turned OFF, WARM LIGHT, WHITE LIGHT, and both lights ON. there was no intensity control.

What was then implemented ?

As the lights were two strong, the first thing I thought was to implement a light intensity control. For that, I also extended the functionalities of the button to respond to events like :

  • Single click ( to change the light composition )
  • Holding the button ( to change the brightness )
  • and, Double click ( to turn off the device )

with those new events responses it was also implemented a new scheme of possible lights composition:

SET WARM (%) WHITE(%)
1 100 0
2 75 25
3 50 50
4 25 75
5 0 100

Then, it was implemented a brightness control of 5 levels pre-defined.

uint8_t const set_brightness[5] = {10,20,30,50,100};

100 represents 100% of brightness, 20 represents 20% and so on;

The percentage of each light is calculated by the formula below ( yellow refers to the warm light )

light_brightness.white = (brightness * light_ratio.white)/ ( light_ratio.white + light_ratio.yellow);

light_brightness.yellow = (brightness * light_ratio.yellow)/ ( light_ratio.white + light_ratio.yellow);

Environment info

  • MCU: PIC12F1840
  • Compiler: xc8 (v2.1)

led_lamp_fw's People

Contributors

jpnbino avatar

Stargazers

Roman avatar

Watchers

Rafael Dias avatar  avatar

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.