Introduction: Three Ways to Control Your Table Lamp

About: Howdy, we are application engineers in Seeed. Sharing projects with the maker community is awesome. Hope you like it XD Seeed is the IoT hardware enabler providing services that empower IoT developers to swift…

Here we share this project for control your table lamp. You can get the light value of surrounding, and display on the OLED. And the most important, we provide 3 ways to control your lamp as well.

Step 1: WHAT DO YOU NEED

We need below electronic modules.

And there're something else you need.

  • Some screw and nut
  • 3mm wooden board
  • A desk lamp

Step 2: LASER CUT THE WOODEN BOARD

Here we will make something to fix the modules.

Download the file and cut it by a laser cutter.

You can find a laser cutter at any maker space near to you, if unlucky you can't find one, you can try the laser cutter service provide by Seeed.

We will get 2 piece of board here. One on the top and the other on the bottom.

Step 3: FIX THE MODULES TO THE WOODEN BOARD

Here we need some M2 screw and Nut.

What you need to do is put the modules on the right place, then turn the screw.

Step 4: CONNECT THE CABLE

You don't need to do any soldering because the good design of Grove.

Just connect the Grove modules to Arduino Breakout board via a Grove cable.

  • Grove - Relay > D4
  • Grove - Light Sensor > A0
  • Grove - Infrared Sensor > D6
  • Grove - Touch Sensor > D7
  • Grove - OLED > I2C

Step 5: CONNECT THE LAMP TO RELAY

First of all you need to get a desk lamp, and you had to damage it.

Clip one wire and connect to the terminal of Grove - Relay, as shown at the above image.

Step 6: SOFTWARE WORK

ou can go to wiki of LinkIt Smart 7688 Duo for getting started.

There're many steps to follow.

1. Download the tool PuTTy

2. Connect 7688 to your PC via s USB2Uart module

3. Set the right baudrate, which is 57,600

4. Open the yunbridge service on 7688Duo

& uci set yunbridge.config.disabled='0'

& uci commit

& reboot

5. Make 7688 connect to Wi-Fi

& vi /etc/config/wireless
config wifi-iface 'sta'

option device 'radio0'

option mode 'sta'

option network 'wan'

option ifname 'apcli0'

option led 'mediatek:orange:wifi'

option ssid ‘********' //Modified this option

option key '********' //Modified this option

option encryption 'psk'

option disabled '0' //Modified this option

& wifi down

& wifi up

# wait for WiFi to connect your router

# Test if WiFi connected

& ping www.seeedstudio.com

# Good result like below

root@mylinkit:~# ping www.seeedstudio.com

PING www.seeedstudio.com (107.150.97.124): 56 data bytes

64 bytes from 107.150.97.124: seq=0 ttl=51 time=226.508 ms

64 bytes from 107.150.97.124: seq=1 ttl=51 time=421.954 ms

6. Download the code here, cd to root of 7688Dyim you can download github repository directly from U disk or ssh service

& git clone https://github.com/Seeed-Studio/Grove_Starter_Kit...

# Operate on 7688 terminal

7. Extract 7688GroveKit.tar to path/root

& cd /root

& tar xvf 7688GroveKit.tar

8. Copy startup script to /etc/init.d/ and run it

& cp /root/mcs_nodejs/mcs_grove_kit /etc/init.d/

& /etc/init.d/mcs_grove_kit start&

& /etc/init.d/mcs_grove_kit enable

9. Go to Mediatek Cloud Sandbox, register as a user and create your test device. refer to Grove_Starter_Kit_for_lks7688Duo/lks7688/MCS Node.pdf

10. Modify mcs_nodejs/app.js

mcs.register = {

deviceId : ‘yourdeviceId’,
deviceKey : ‘yourdeviceKey’, }

11. Modify mcs_upload_data.sh

& vi mcs_upload_data.sh

-H "deviceKey: {DeviceKey}" # Modify {DeviceKey} by yours
-d "light_sensor,,${DATA}" # Modify light_sensor by yours 'http://api.mediatek.com/mcs/v2/devices/{DeviceId}/datapoints.csv' # Modify {DeviceKey}

12. Install Arduino IDE(after 1.64), and Install MTK7688SDK http://download.labs.mediatek.com/package_mtk_lin...

13. Set up you IR remote, you can use any remote, and any key. There's few steps to follow:
i. Download the IR Receiver Library

ii. Add one line of code at IRSendRevInt.h #define CORE_OC4A_PIN 6

iii. Run Recv.ino, and open the Serial monitor, press a key. Then you will get some data. Here we get data = {128, 127, 192, 63, 192, 63}

14. Download library for 7688Duo

15. Modify lks7688GroveStarterKitDemo.ino at line-19 and change to your IR code

16. Build and upload program

Step 7: MAKE IT WORK

After the whole thing is done. Please try to control your lovely lamp via the 3 ways.

  • Control by IR remote
  • Control by the Touch Sensor
  • Go to MediaTek cloud and control the lamp.

Cheers.