The project started with the idea of creating a very simple lamp for home or work usage with the basic feature anyone could look for a decent lamp :
- analog control for brightness,
- adjustable solar light (from white to yellow),
- adjustable color (around the color circle),
- a rainbow animated mode (there is always something to celebrate someday !).
Then I received the 8266ex chip (also called esp01) that offered a possibility to try build a connected lamp. As I found I spent too much time control nightscout data with smartphones or computers, I decided try add a lamp mode to the previous project that could report the information I'm looking for.
What is Nightscout ?Nighscout is an opensource software helping diabetic type 1 patient, their famillies to monitor their glycemic state. The medical material, which usually consist in an insulin pump and a glucose sensor, report the medical data to the Nightscout server thanks to a Nightscout uploader. The Nighscout uploader is a software on a smartphone that connect to the insulin pump to collect the medical data. This is a very useful technology for night monitoring and for daily monitoring also for young kids affected by this disease, helping anyone that need it to access the medical information.
Nightscout LampI used a regular neon tube from which I removed the ballast, tube holders and wires. I installed a new AC Power and a 37 led strip ws2812b.
The Nightscout lamp actually reports :
- if medical data is outdated (20min) : fast rainbow mode,
- patient glycemic state using 5 colors (for 5 glycemic target ranges) : glowing light in case of rapid glycemic changes,
- the battery level of the data uploader and the insuline pump.
- the nightscout lamp has two internal modes : plain or points. The points mode shows the last 3 patient glycemic values on a glycemic scale.
The lamp helps people who needs to monitor the glycemic state of a diabetic type 1 patient. The information is available in a second looking to the lamp, without it requires to manipulate a device.
The lamp could also helps diabetic type 1 kids before 5 years old. The knowledge of internal feelings and the capability to express what they do feel inside their body will still take a couple of months, years. The lamp could help them have a better knowledge of what they do feel inside their body depending of the light color reported by the lamp.
The lamp is a third party to help parents explain their kids why sometime it is possible or not to get a candy.
Low or high glycemic are known to have an impact on patient mood. The lamp sharing the information about the glycemic state of the patient could help understand patient mood changes.
Circuit LimitsCurrent AC power delivers 5V 6A max. At full brightness a ws2812b led consumes 60mA. It means we should be able drive around 100 leds with this 30W AC Power. With 37 leds we actually should require 11W max.
The circuit diagram is not explicit with this but the led strip should not be powered through the arduino board. Excessive current call from the strip may damage your board.
Softwares LimitsBoth softwares miss a strong layer for error and trouble management.
You may notice the nightscout-gw requires static definition in its code for WIFI access and for nightscout server, port and token. It would be nice to have a small SD card storage connected to arduino to store this information that could be send through the serial line to the 8266ex chip. The software does not make any control against the SSL certificate served by the Nightscout server.
nightscout-lamp will not react correctly when the glucose sensor will calibrate or when the radio signal is broken between the pump and the glucose sensor.
I was not able setup more than 38400 baud/sec on the serial line between the arduino uno (an alixpress clone also) and the esp01 (8266ex chip) while I was able to upload or connect to the 8266ex at 115200 baud/sec from my computer.
Tip and TricksThe arduino will experiment serial communication errors (chars modified or deleted) if it try to operate the ws2812b strip at "the same time" of the serial communications. The arduino is not multitask, it will in any case operate a task after another. But I noticed serial communications was quite better if I managed the arduino not to operate the ws2812b strip while trying communicate on a serial line.
Take advantage of the arduino board, using it as an UART bridge to the 8266ex. link the RESET and GND pin on the arduino board. Power the esp01 device with the 3.3V from the arduino board. Use a voltage divider (or not) to connect 8266ex rx/tx to the arduino rx/tx channels. Please check the 6 PIN to wire correctly to VCC, GND, RX, TX. Once done you'll be able upload your code from the arduino IDE.
Comments