element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Bluetooth Unleashed Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Bluetooth Unleashed Design Challenge
  • More
  • Cancel
Bluetooth Unleashed Design Challenge
Blog Bluetooth Unleashed : AAPSAD #6 : The Mooooood Lamp
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: sakthi.1260
  • Date Created: 7 Jun 2018 8:34 PM Date Created
  • Views 893 views
  • Likes 6 likes
  • Comments 3 comments
  • mood lamp
  • wifi
  • yeelight
  • bluetooth_unleashed
  • rpi 3b+
Related
Recommended

Bluetooth Unleashed : AAPSAD #6 : The Mooooood Lamp

sakthi.1260
sakthi.1260
7 Jun 2018

Hello guys image,

On last weeks update our hero started detecting emotions like a charm,Now I had a confusion on what to post this week image

While cleaning our work space found a mysterious white box!

image

 

With no clue what it was and a curiosity to know went forward and opened it.

 

Surprise!

image

A brand new Yeelight Color bulb, had no clue why it was here, or when it was purchased, but I replaced my wall lamp with this one and started playing and I found a cool feature called the LAN control.

After going through their developer page there was a spark!image

Initially I planned to use Addressable LED strips to make a Mood light. But found this to be a great replacement over the LED Strip, Its bright and fill the room with color, exactly something I wanted.

image

So after a little bit of research found an easier way to access it from the Rpi itself via Wifi using a simple shell script!

Adding a few more lines of code to emotion.py from the previous post, it worked in an amazing way

if emo == 'a' :
  os.system('./light.sh color Teal')
  os.system('./light.sh brightness 20')
  os.system('omxplayer Anger.mp4')
  os.system('killall omxplayer.bin')
if emo == 'j' :
  os.system('./light.sh color Yellow')
  os.system('./light.sh brightness 20')
  os.system('omxplayer Joy.mp4')
  os.system('killall omxplayer.bin')
if emo == 's' :
  os.system('./light.sh color Lime')
  os.system('./light.sh brightness 20')
  os.system('omxplayer Sorrow.mp4')
  os.system('killall omxplayer.bin')

 

Having some issues with our Github repo, should be fixed shortly for now here are the two scripts one to configure the yeelight and another to control it.

 

configure.sh

echo "Configuration started"
ip=$(arp -n | tail -n+2 | awk '{print $1","$3}' | grep -i ",34:ce" | awk -F, '{print $1}' | head -n 1)
bulbs=$(echo $ip | awk '{print NF}')
echo "$bulbs device(s) detected with MAC address match"
echo "Checking if port 55443 is open"
x=1

# Only pick the first IP for now - if multiple bulbs exist, use awk to cycle through
candidate_ip=$(echo $ip | awk '{print $1}')
verified_ip=$(netcat -zvw1 $candidate_ip 55443 2>&1 | grep "succeeded" | awk '{print $3}')

echo $verified_ip > ip.list
echo "$verified_ip added to ip.list"
echo "Configuration completed"

 

light.sh

command=$1

[ -f ip.list ] && ip=`cat ip.list` || echo "Please run configure-light.sh first if you haven't run it before in this netwo$

case $command in
"on")
 printf "{\"id\":1,\"method\":\"set_power\",\"params\":[\"on\",\"smooth\",500]}\r\n" | nc -w1 $ip 55443
 ;;
"off")
 printf "{\"id\":1,\"method\":\"set_power\",\"params\":[\"off\",\"smooth\",500]}\r\n" | nc -w1 $ip 55443
 ;;
"color")
 color_hex=$(grep -i $2 colors | awk -F, '{print $2}')
 color_int=$(printf '%d' $color_hex)

I looked angrily onto the camera and here's a sneak peak image

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Cheers,

  • Sign in to reply

Top Comments

  • genebren
    genebren over 7 years ago +1
    Nice update to your design challenge project. It is really nice when we are looking around and we find some cool little thing that we forgot that we had! Looks like you are getting most of your project…
  • sakthi.1260
    sakthi.1260 over 7 years ago in reply to genebren +1
    Thanks Gene, still having few issues hope that too goes well Cheers
  • aspork42
    aspork42 over 7 years ago +1
    Nice job - It would be fun to have a light you can control just by smiling at it
Parents
  • genebren
    genebren over 7 years ago

    Nice update to your design challenge project.  It is really nice when we are looking around and we find some cool little thing that we forgot that we had!  Looks like you are getting most of your project close to being done.

    Keep up the good work!

    Gene

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • sakthi.1260
    sakthi.1260 over 7 years ago in reply to genebren

    Thanks Gene, still having few issues hope that too goes well image

     

    Cheers

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • sakthi.1260
    sakthi.1260 over 7 years ago in reply to genebren

    Thanks Gene, still having few issues hope that too goes well image

     

    Cheers

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube