element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Arduino
  • Products
  • More
Arduino
Blog [Dynamic Living-Room Lights] IoT Holiday Lights Minions
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ipv1
  • Date Created: 20 Jan 2015 6:20 PM Date Created
  • Views 1369 views
  • Likes 2 likes
  • Comments 5 comments
  • iot_holidaylights
  • ip_iot
  • holiday_mood
Related
Recommended

[Dynamic Living-Room Lights] IoT Holiday Lights Minions

ipv1
ipv1
20 Jan 2015

  • Link to previous posts
  • Preface
  • Getting Minions and assigning them positions
  • Epileptic Minions -
  • A simple motor switch
  • Raspberry Pi program to control the motor
  • Getting Tweets with Python
    • Say hello to Temboo
  • Putting it all together

Link to previous posts

  • [Dynamic Living-room Lights] Description
  • [Dynamic Living-room Lights] Simple System Design
  • [Dynamic Living-Room Lights] The YUN review - When the Penguin Met The Arduino.
  • [Dynamic Living-Room Lights] The Infineon RGB LED Shield Review
  • [Dynamic Living-Room Lights] The Infineon RGB LED Shield -Library!
  • [Dynamic Living-Room Lights] The Lights Teaser Video
  • [Dynamic Living-room Lights] The YUN talks to OpenHAB
  • [Dynamic Living-room Lights] Building the Mood Lights
  • [Dynamic Living Room Lights] The XMAS Tree

 

Preface

 

My project for the Internet of Holoday lights was based around our living room which was not very livable. It was a mess and with the upcoming holidays I wanted to set the living room in such a way that it would be suitable for entertaining guests. Additionally I wanted to accomplish the above mentioned in such a way that the holiday lighting becomes part of the living room and I don't need to remove it after the holidays. Hence the concept of Dynamic Living-room Lighting.

 

In the previous posts, I have review the YUN and the infineon shield and have presented an overview of the project system. I also setup the place for the lighting with some homemade arts and crafts and give a preview of the system setup. I explained the Library I made for the Infineon Shield as well as the implementation for the MoodLights and made them Dynamic. I also made a XMAS Tree with LEDs and some stuff.

 

In this post I add a minion element to the project. I had initially planned to have a Santa Claus ring his bell everytime someone wishes me on twitter, but santa is busy and I have minions...

 

Getting Minions and assigning them positions

Now minions don't exactly submit their resume via email and the ones I have a pretty lazy hence I embarked on a long journey to... Well actually I had my wife make some image We had two types of minions where the first type were lazy and wanted to enjoy the party by the fireplace. These were handmade by my wife and were featured in a previous blog. The second type were party type and I printed them out and cut out the outlines. Making these minions dance was a challenge since they needed some 'support'. Now I don't have a fancy 3Dprinter(hint hint image )so I resorted to what I did have and that was a lot of empty element14 cardboard boxes. And thus began my evil plan to make the minions work overtime. Muahhaa ha ha! Take a look.

 

I took apart the cardboard boxes for raw materials.

903c742fc9f2065998315eb4913098a6.jpg

Next I used a stapler and a knife to make a prop.

b6d58bbfa37eed95aa99e223f7301135.jpg

 

Next I added some mechano part from an earlier experiment. These were quite cheap 10years ago when they were presented to me. Thus my CAM and PISTON Design began to emerge from the fires of mount cardboard. image

9bf504ac1629d9fef286e226ceb83a25.jpg

The minions stood by and I used glue to MAKE them participate in my experiment. Their styrofoam spines stuck like... styrofoam!

9139616cc99b8373c11be1b3417bb32f.jpg

Laughing gas..!

aa9ea315d7552e66551f5eef5402a9d1.jpg

And lastly an old toy that was relieved of it's limbs, became useful again!

5ef6dd7e03f6642ca8de9659f19f6e77.jpg

 

With that, now I have minions that dance at will.

 

Epileptic Minions -

Disclaimer! No minions were harmed(without consent) in the making of this project. The minions do dance but since the mechanism is made from material that is not stiff enough, it tends to cause... kind of epilepsy in the minions. The motor and gear system I use is from a discarded toy and due to it's gear-ratios and placement of cam, the whole thing pulls around 300mA when working. See video below.

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

Its clear that its not perfect and a better mechanism would solve the problem. The reason why I did not use a servo motor is because I don't have any. I got one which I used for the minion bot for the 'forgetmenot' challenge. But it works and I am willing to admit that my minions dance bad, but they can dance.

Unfortunately, the geared system sucked up too much power and it broke down a few days ago. Hence I went out and bought out a geared motor and after a little DIY magic, I got the arrangement shown below.

3c6f760a1928a323f4e34c099b9ec138.jpg

 

Moving on to the control part...

 

A simple motor switch

The minions dance when a small voltage is supplied to the motor. This I need to control via the raspberry Pi. Why not the YUN? I will that part explain later. For now, I need to make a small circuit that enables me to connect a small motor to the raspberry pi. The input signal is from the raspberry pi and the motor runs on 5V. The new motors draw around 100 -175mA at 5V which is not bad and I made a little transistor driver which can work as a switch. In order to control the speed, I simply added a 1K present between the motor and the transistor. That should enable me to calibrate the speed without messing with the PWM module. See, I took care of the simple stuff in the simplest way! The circuit is shown in the images below.

5a89dff8888204e8d13d905ce0f2d322.jpg

 

The speed is adjusted and it looks a little better than before. How better, you be the judge of that but this is the best I could do. Now to control it via the RPi

 

Raspberry Pi program to control the motor

In order to control the motor, we need to write a program to toggle the GPIO which is connected to the transistor. This can be done in a number of languages but I chose python. This is relatively simple and there are lots of tutorials on the internet for this part. I wrote and tested some code and it is given below.

 

#! /bin/python
import RPi.GPIO as GPIO
import time


#setup the Pin for the control
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, false)


#loop the loop
while(True):
    GPIO.output(18, true)
    time.sleep(10)
    GPIO.output(18, false)
    time.sleep(10)

 

This works and makes the minions dance for 10 seconds and stay still for 10 seconds and repeat.

 

Getting Tweets with Python

In my initial proposal, I wanted to have Santa ring his bell to greetings published on twitter with me mentioned. In the present case, I would use them to make the minions dance. Easier said than done and there are a number of tutorials out there about accessing twitter and the like using python. In my case, I wanted the tweets with hashtags like #happynewyear and #happyholidays etc to trigger the actions. I want only tweets with mentions to me @ip_v1 on twitter which can be accomplished a number of ways. This would involve reading the twitter feed and finding mentions and then searching for hashtags. If one is found, then the action is to be initiated. Additionally some record of the hashtag must be retained so as to distinguish between redundant instances. In my experiments, I tried do thing by many methods where the timestamps were grabbed and a few other hoops but at the end, I found a simpler method that just works.

 

Say hello to Temboo

Temboo is an online service that allows you to generate code for IOT applications in a variety of languages and devices such as CC3200 and the Arduino YUN. I used it to generate code to get tweets with mentions in python. The tweets are received in JSON format but for my solution I don't care about that. I simple use the find function

 

#! /usr/bin/python

from temboo.Library.Twitter.Timelines import Mentions
from temboo.core.session import TembooSession


import json
import re
import time

#Some global stuff here
prt_dept=50 #dept of fingerprint characters
finger_print = 'NULL'
keywrd1 = '#happy'


# Create a session with your Temboo account details
session = TembooSession("inderpreet", "myFirstApp", "XXXX")


# Instantiate the Choreo
mentionsChoreo = Mentions(session)


# Get an InputSet object for the Choreo
mentionsInputs = mentionsChoreo.new_input_set()


# Set the Choreo inputs
mentionsInputs.set_AccessToken("XXXX")
mentionsInputs.set_AccessTokenSecret("XXXX")
mentionsInputs.set_ConsumerSecret("XXXX")
mentionsInputs.set_ConsumerKey("XXXX")


while(True):
    print '\n#######################\nWoke up!'
    #Code to get the mentions


    # Execute the Choreo
    mentionsResults = mentionsChoreo.execute_with_results(mentionsInputs)
    response = mentionsResults.get_Response();


    #My work begins here
    #Mentions are now in response so convert to lower case
    resp_lower=response.lower()


    #match string1
    index1=resp_lower.find(keywrd1)


    #IF we find a match, then
    if(index1>0):
        #get new fingerprint
        new_fingerprint = resp_lower[(index1-prt_dept):index1]


        #Compare Fingerprints for new and if it IS then...
        if(finger_print!=new_fingerprint):
            finger_print=new_fingerprint;
            #Do the required action here
            print 'Found New Mention'
        else:
            print '\nNothing New'
            #else Nothing
    #Sleep for 1 minute
    print 'Sleeping...'
    time.sleep(60)

 

This code works out and I have commented it for anyone who wants to modify it for their use and if you have a better way of doing this, please do let me know.

 

Putting it all together

Once I put together the code as well as the mechanical structure, the whole thing works. Below is a video demo for documentation purposes.

 

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

At this point I am almost done with my project but I need to complete the documentation for the actual living room. I hope to complete that tomorrow. A lot of time and energy has been put in to make this project and I hope everyone likes the results.

 

 

Cheers,

IP

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 10 years ago +1
    Inderpreet. Very Good. newsflash .... Minon inspired theme was attacked today in a new type of 'Denial Of Service' attack where the trigger comment was sent repeatedly. The occupants were heavily sedated…
  • ipv1
    ipv1 over 10 years ago +1
    Thanks Peter Sir, Working on these is both enjoyable as well as exhausting. Even though my proposed goal was not as 'BIG' as yours, still putting everything together and working on the presentation took…
  • ipv1
    ipv1 over 10 years ago

    Thanks Peter Sir, Working on these is both enjoyable as well as exhausting. Even though my proposed goal was not as 'BIG' as yours, still putting everything together and working on the presentation took a LOT more than I had expected. My brain has been abuzz with a lot more ideas, and its been hard to keep on track and finish what I started. I am quite happy with the results and I am hoping others will try out some of these ideas on the blogs as well as else where. image

     

    Thanks DAB Sir, Most of what I make is out of scrap since I don't really have an option and I hope others try out these methods and also suggest alternative scrap image

     

    Thanks Jan Sir, That's what I was hoping for. Those dancing minions have made a lot of visitors happy as well. image

     

    Thanks Mark sir, The DDOS attack is one reason I did not attach a live video feed to the minions dancing else my twitter account would be full of wishes. I did get a Raspberry Pi to stream video for my quadcopter project's FPV and wanted to stream the project live but it did not seem like a good idea AFTER so many days of xmas past... Hence next year image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 10 years ago

    Inderpreet.

    Very Good.

     

     

    newsflash ....

    Minon inspired theme was attacked today in a new type of  'Denial Of Service' attack where the trigger comment was sent repeatedly.

    The occupants were heavily sedated before being taken away, and doctors say in a few weeks they will be fit to return.

    In the meantime staff caring for them were warned to not use the term 'happy'.

     

    image

    Mark

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 10 years ago

    Neat! And two great videos.

    They've put a smile on my face.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago

    Great entertaining post.

     

    I especially like your simple implementation, anyone should be able to animate their favorite minion or other character.

     

    Well done.

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago

    I like it,

     

    and I feel the pain regarding how much time this particular challenge has soaked up, way way more than i ever imagined

     

    Good luck with the final stretch

     

    Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
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