DevJav / best_friend_lamp_arduino

Best friend lamp project made with Arduino
16 stars 6 forks source link

Arduino Best Friend Lamps

lamp-gif

This project objective is to make a cheap, open source version of what's commomnly called a best friend/friendship/long distance lamp, like this one or this one.

The idea is having two (or more) lamps connected so as when one of them is turned on, the others will turn on.

This project is a modification and ampliation of CoronaLamps, so thanks to the authors for making it public.

Material used (per lamp)

These components could be easily replaced for por example another microcontroller like ESP32, different LED type (but directonal) or even a different lamp.

All together looks like this:

drawing

The touch sensor has a wire connected so it will cast less shadows inside the lamp, however this might be what makes the sensor trigger by itself sometimes :(

Adafruit IO setup

Adafruit IO is a free use server that we will use to communicate the lamps. You must create an account and create a new feed with whatever name you want. This created feed is where the messages from the lamps will be published.

Code setup

First of all, we need to have Arduino IDE installed and the ESP8266 configuration added. You can follow this tutorial to achieve that.

We also need to install some libraries:

Changes in best_friend_lamp_arduino.ino:

Changes in config.h:

Here we will add our login credentials to Adafruit IO. In the web page, go to "My Key" and copy the Arduino section. Then it should be paste on the config file:

    #define IO_USERNAME  "user"
    #define IO_KEY       "key"

After making this changes, the program can be uploaded to both lamps, just remember to change the lampID for each one.

User manual

The first time the lamp is connected, or if the Wifi has changed, the lamp will light 4 different colors, indicating that it is not connected to internet. The micro will create a Wifi connection called "Lamp" and with password "password" (can be changed if you're afraid to be hacked). Connect to it (from your phone for example) and navigate to "192.168.4.1". From there, you can configure the connection.

Once the internet setup is done, it will connect to Adafruit IO. During this process light will spin on green, and when its done, it will flash.

Now it's ready to use. To send a message, touch the lamp for 2 seconds and it will light up on red. Touch again and again and the color will change. When you decide the one you like, wait some time and after a flash, the message is sent. Now, both lamps will make a breath animation until the one who received the message is touched (considered an answer) and will turn on at 100% for 15 minutes, or until 15 minutes have passed without response and it will turn off.

Known issues