Giter Club home page Giter Club logo

lampcolorcontroler's Introduction

Lamp-Da

A compact lantern project.

This repository contains the software and PCB files to create a compact lantern, composed of a led strip wrapped around a 50mm cylinder.

The code is not designed to be the most readable but to be robust, so it can be quite tricky to understand, sorry !

Behavior

base behavior:

  • The lamp starts and stops with one click.
  • The luminosity can be raised by clicking than holding, and diminished by double-clicking than holding.

The battery level is displayed as a color gradient from green (high) to red (low).

battery levels

Error and alerts are displayed as blinking animations:

  • low battery: slow red blinks
  • critical battery: fast red blinks, emergency shutdown
  • charging: breeze animation, changing color to reflect battery level
  • incoherent battery readings: fast green blinks
  • main loop too slow: fast fushia blinks
  • temperature too high: fast orange blinks
  • temperature extreme: emergency shutdown
  • bluetooth advertising: blue breeze animation
  • unhandled: fast white blinks

User defined behaviors

The user MUST define the target behavior for the target uses.

Some functions are defined in user_functions.h, and must be implemented in user_functions.cpp They allow the user to program the exact desired behavior.

Some branches are available for base models:

  • cct_led_strip: Program designed for a constant color temperature led strip.
  • constant_current_control_base: Program designed for a constant color led strip
  • indexable_strip_base: program designed for an indexable led strip wrapped around the lamp body

The different lamps Above: constant colors, cct, indexable

File details

  • Lamp-Da.ino: main class of the program, containing the setup and loop functions
    • user_constants.h: constants defined by the user for the program. they must be updated to match the lamp characteristics
    • user_functions.h; function called by the program, that the user must update for a specific application

Physical build and architecture :

The electrical circuit and build files can be found in the electrical folder.

electrical circuit

The PCB can be ordered directly assembled from JLC PCB, for a total cost of around 270$ for the minimal 5 pieces command (price drops with a more commands, until around 11$/circuit).

The circuit is 4 cells li-ion USB C charger, that is also programable via the same USB port. It features a constant current strip that can be as high as continuous 2.3A, controled by PWM.

The circuit features:

  • USB-C 4S li-ion charger, based on BQ25703A ic.

  • USB short circuit and EC protection, based on TPD8S300 ic.

  • USB-C power negocitation, base on FUSB302 ic.

  • Constant current led driver, that can maintain stable up to 2.3A, based on LM3409HV ic.

  • 9 programable IO pins (4 of which can be analog inputs, 4 can be pwm outputs). Based on nRF52840 ic.

  • MEMS Microphone, placed away from parasitic ringing components.

  • LSM6DS3TR IMU, placed on the exact center so the axis alignement is easy.

  • Bluetooth 5.1 low power, with correct 5/10m range.

  • Multiple protection features (ESD spikes protection, USB voltage snubber, USB voltage limitation, ...)

Be careful:

  • NO REVERSE VOLTAGE PROTECTION FOR BATTERY: it will blow the circuit right up
  • IO are 3.3V max, any voltage greater will destroy the system

How to program

Out of factory, the system will miss a bootloader. You can flash a bootloader using the IO | CL pads on the board, with a JTAG probe, or an open source solution described below:

Once the bootloader is written, the microcontroler can be programed via USB, using the Arduino IDE or any flashing program.

Bootloader flash

  • Use a raspberry of any other linux system with gpios
  • Use the open source program openocd as described in this post

Program flash

Install the Adafruit nRF52 board support (version 1.6.1) as described here

Do not forget to replace the content of the version folder in .arduino15/packages/adafruit/hardware/nrf52 by the content of the above repository.

After restarting the Arduino IDE, you can select "LampDa nRF52840" in Tools > Board > Adafruit nRF52 Board.

After that, use the Arduino IDE as always, the program will compile for the LampDa board.

lampcolorcontroler's People

Contributors

baptistehudyma avatar

Stargazers

Sean Stevens avatar

Watchers

 avatar

lampcolorcontroler's Issues

Add blinking when battery gets low

  • In branch constant_current_control_base

Add the following behavior:

Blink once when the battery gets below 75%
Blink twice at 50% battery
Blink three times when the battery falls below 25%

Add IMU support

In branch main

Add support for the IMU (start, stop, measure, filter)

Implement USB PD negociations

In branch main

Implement the communication with the RT1715 component to enable USB PD.
Implement maximum power delivery mecanism to support all charger.

Enable USB OTG

in branch main

The user should be able to enable the USB OTG function.

Default the output to 5V 1A max.

Reduce startup time

in branch main

The startup time is about 1 second, which seems too long.
it should be reduce to below 200ms.

Observations:
This startup time seems to come from the two first function called in the program setup function

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.