Another IoT Platform in the (Blue)Mix

Many major companies (Intel, Oracle, Atmel, and IBM, for example) are competing to be the standard interconnect fabric for the Internet of Things. As a developer, it is hard to cut through the marketing hype and decide which platform is the best for you and your application. Luckily, there’s a plethora of projects on the web that showcase these frameworks. These project sites are an easy way to evaluate the strengths and weaknesses of IoT frameworks in practical applications without having to develop prototypes yourself.

[diyhacking], for example, posted a demo of using IBM’s Bluemix along with a Raspberry Pi, to do some simple home automation tasks. The project hardware is modest, using a PIR motion sensor and a relay to control an AC load. However, that’s good because it lets you focus on the Bluemix tools. The example client and server software is less than 200 lines of Python.

Bluemix looks like it has good integration with the Raspberry Pi and features a simulator so you can work without real hardware for development. Bluemix does offer a free plan (with limits), but the fee options may be a turn off to some IoT hackers.

Continue reading “Another IoT Platform in the (Blue)Mix”

Automatically Designing 3D Printers From E-Waste

No one wants to design consumer electronics that last longer than a few years. This trend is an ecological disaster, with millions of tons of computers, printers, fax machines and cell phones ending up in landfills. In these landfills, all the lead and chemicals used to extract minuscule amounts of gold plating leech into the environment. Turning it all around is monumental, but reusing some of this waste can help make a difference.

[Masterperson] and [Maaphoo] have been working on a way to turn those tons of e-waste into something useful. They’ve come up with a framework for turning e-waste into 3D printers. With a clever application of Python and FreeCAD Macros, this project can generate a model of a 3D printer using motors, shafts, and bearings taken from discarded 2D printers.

Right now a printer can be configured by adding the parts you have on hand to a configuration file, running a Python macro in FreeCAD, and waiting until the macro generates the parts to build a cartesian bot. This macro also spits out the files for the parts that need to be printed, and can interface with Plater to optimize the placement of these printed parts on an existing printer.

It’s a very cool project, but it’s not done yet: the team is looking for help to refine the printer designs and possibly growing more designs than a simple cartesian bot. Anything that is explicitly designed to pick the meat off of 2D printers is a great idea, and turning those into real 3D printers is the cherry on top.

LED Strip Notifies You Of The Light Show You’re Missing Outside

Unless you live way up in Canada, it’s not very likely that those gorgeous coronal mass ejections will collide with the atmosphere above your home. If they do, it’s a rare occurrence you wouldn’t want to miss. This is why [James] devised of a special alarm that would notify him when the Northern Lights may be visible in his neck of the woods. And what’s a better aurora alarm than a simulated aurora light show for your room?

[James] uses a Raspberry Pi to check data from Aurora Watch UK at Lancaster University for local activity. If the forecast reads that there may be some light above his home town in northern England, it triggers a NeoPixel LED strip to scroll through the color values of an actual aurora PNG image. This produces the same sporadic shifting of colors for a proximal ambient indoor lighting effect… though slightly less dramatic than the real thing. You can take a look at his Python script on github if you feel inspired.

Continue reading “LED Strip Notifies You Of The Light Show You’re Missing Outside”

How to Make Amazon Echo Control Fake WeMo Devices

[Chris] has been playing with the Amazon Echo. It’s sort of like having Siri or Google Now available as part of your home, but with built-in support for certain other home automation appliances like those from Belkin WeMo and Philips. The problem was [Chris] didn’t want to be limited to only those brands. He had other home automation gear that he felt should work with Amazon Echo, but didn’t. That’s when he came up with the clever idea to just emulate one of the supported platforms.

The WeMo devices use UPnP to perform certain functions over the network. [Chris] wanted to see how these communications actually worked, so he fired up his laptop and put his WiFi adapter into monitor mode. Then he used Wireshark to start collecting packets. He found that the device detection function starts out with the Echo searching for WeMo devices using UPnP. The device then responds to the Echo with the device’s URL using HTTP over UDP. The Echo then requests the device’s description using that HTTP URL. The description is then returned as an HTTP response.

The actual “on/off” functionality of the WeMo devices is simpler since the Echo already knows about the device. The Echo simply connects to the WeMo over the HTTP interface and issues a “SetBinaryState” command. The WeMo then obliges and returns a confirmation via HTTP.

WeMo Echo
How Echo Communicates with WeMo Devices

[Steve] was able to use this information to set up his own WeMo “virtual cloud”. Each virtual device would have its own IP address. They would also need to have a listener for UDP broadcasts as well as an HTTP listener running on the WeMo port 49153. Each virtual device would also need to be able to respond to the UPnP discovery requests and the “on/off” commands.

[Chris] used a Linux server, creating a new virtual Ethernet interface for each virtual WeMo switch. A single Python script runs the WeMo emulation, listening for the UPnP broadcast and sending a different response for each virtual device. Part of the response includes the device’s “friendly name”, which is what the Echo listens for when the user says voice commands. Since the virtual WeMo devices are free, this allows [Chris] to make multiple phrases for each device. So rather than be limited to “television”, he can also make a separate device for “TV” that performs the same function. [Chris] is also no longer limited to only specific brands of home automation gear.

There’s still a long way to go in hacking this device. There’s a lot of hardware under the hood to work with. Has anyone else gotten their hands (and bench tools) on one of these?

Virtual LCD Using Python

[Prashant Mohta] got hold of a Raspberry Pi, a 16×2 LCD display and got down to writing a simple game in Python. Pretty soon, he realized that it was cumbersome to have the Ras-Pi and LCD connected when all he wanted to do was write the code. So he wrote a simple Python module which renders the LCD on his computer display. A simple, quick, useful hack.

[Prashant]’s code relies on the use of Pygame, a set of Python modules designed for writing games. His code uses just two functions – one to define the LCD (characters and number of lines) while the other draws the characters on the screen by looking up an array. The code is just under 20 lines and available from his Github repo. It will be useful to those who are getting started on Python to help them understand some basics. Python is awesome and writing Python code is pretty simple.

This might draw some flak from the naysayers so if you’re commenting below on the merits, or not, of Python, just keep your comments civil and healthy. In the video below, unrelated to this hack, [Raymond Hettinger] talks about “What makes Python so Awesome”!

Continue reading “Virtual LCD Using Python”

Motion Sensing Water Gun Tweets Photos To Embarrass Enemies

[Ashish] is bringing office warfare to the next level with a motion sensing water gun. Not only does this water gun automatically fire when it detects motion, but it also takes a photo of the victim and publishes it on Twitter.

This hack began with the watergun. [Ashish] used a Super Soaker Thunderstorm motorized water gun. He pulled the case apart and cut one of the battery wires. he then lengthened the exposed ends and ran them out of the gun to his control circuit. He also placed a protection diode to help prevent any reverse EMF from damaging his more sensitive electronics. The new control wires run to a MOSFET on a bread board.

[Ashish] is using a Lightblue Bean board as a microcontroller. The Bean is Arduino compatible and can be programmed via low energy Bluetooth. The Bean uses an external PIR sensor to detect motion in the room. When it senses the motion, it activates the MOSFET which then turns on the water gun.

[Ashish] decided to use Node-RED and Python to link the Bean to a Twitter account. The system runs on a computer and monitor’s the Bean’s serial output. If it detects the proper command, it launches a Python script which takes a photo using a webcam. A second script will upload that photo to a Twitter account. The Node-RED server can also monitor the Twitter account for incoming direct messages. If it detects a message with the correct password, it can use the rest of the message as a command to enable or disable the gun.

Reverse Engineering how a USB Switch Switches

[Daniel] found himself with a need to connect a single USB device to two Linux servers. After searching around, he managed to find an inexpensive USB switch designed to do just that. He noticed that the product description mentioned nothing about Linux support, but he figured it couldn’t be that hard to make it work.

[Daniel] started by plugging the device into a Windows PC for testing. Windows detected the device and installed an HID driver automatically.  The next step was to install the control software on the Windows system. This provided [Daniel] with a tray icon and a “switch” function. Clicking this button disconnected the HID device from the Windows PC and connected the actual USB device on the other side of the USB switch. The second computer would now have access to the HID device instead.

[Daniel] fired up a program called SnoopyPro. This software is used to inspect USB traffic. [Daniel] noticed that a single message repeated itself until he pressed the “switch” button. At that time, a final message was sent and the HID device disconnected.

Now it was time to get cracking on Linux. [Daniel] hooked up the switch to a Linux system and configured a udev rule to ensure that it always showed up as /dev/usbswitch. He then wrote a python script to write the captured data to the usbswitch device. It was that simple. The device switched over as expected. So much for having no Linux support!