python

[Saulius] couldn’t find a cost-effective wireless scale that did what he wanted, so he reverse engineered the communication protocol for an off the shelf model to get weight data himself.

[Saulius] bought a cheap Maxim 29-66SH scale that uses infra-red to communicate to a detachable digital readout. Using the USB IR toy, [Saulius] intercepted the messages that were broadcast. After a little reverse engineering and with the help of some Python scripts, he soon discovered the protocol his scale was using to encode weight messages.

[Saulius] went on to write a little web app using JavaScript, SocketIO and Tornado, a light weight Python web server. By connecting to the tiny web server that’s interfaced with a Python script listening for the scales messages received from the USB IR toy, [Saulius] was able to see his weight displayed on his smart phone through a web browser.

Since all the communication is through IR, there is no need to do any invasion of the scale as the receiver can be placed anywhere in line of sight from the transmitter on the scale itself.

If there’s one thing about Python that’s slightly disconcerting, it’s the complete lack of braces, or as they’re called in American English, suspenders. A feature of every variety of C, Java, PHP, Perl, and a whole bunch of other very powerful languages, braces make things more legible and don’t rely on precise indentation. [Ruby] and [Eran] have come up with a way to use these punctuation marks with Python in a project they call Python with Braces.

As its name implies, Python with Braces doesn’t care about indentation: you’re free to make you code extremely ugly, or write your code properly in K&R style. Each line is terminated in a semicolon, and blocks of code with only one statement don’t require curly braces, just like C and Java.

Right now [Ruby] and [Eran] have a Windows installer with an OS X package on its way. Executing a Python with Braces script only requires executing it with a ‘pythonb’ executable instead of the normal ‘python’ executable.

[ch00f] managed to capture some holiday spirit this year by translating all of A Christmas Carol to scrolling text. Dickens’s work has long since entered public domain, which led [ch00f] to wire up a GeekCatch programmable display from Amazon. It has a low refresh rate, which means videos look a bit goofy, but it’s perfectly acceptable for text. [ch00f] ditched the remote control and instead used the display’s serial connection to program in the novella. Unfortunately, he could not find any documentation for the serial protocol, but he was able to reverse engineer it with some freeware applications found online.

It takes over six hours for the sign to spit out the entirety of A Christmas Carol, which easily surpassed the display’s limited text buffer. [ch00f] instead had to send text to the display one paragraph at a time via a custom Python script. This solution takes advantage of the sign’s fixed-width font to estimate the time it takes for each character to scroll by, then immediately feeds the sign a new line.

Check out the blog post for a quick teardown of the display itself and for a detailed description of the protocol in case you decide to use this display for a project. Stick around for a video below!

It seems that Bitcoin is all over the news nowadays, but the Bitcoin Bot is probably the first robot that will dance for Bitcoins.

[Ryan] at HeatSync Labs in Mesa, AZ, is a fan of the cryptocurrency, and decided to build something to accept it. He discovered that Coinbase, a popular hosted Bitcoin wallet service, has a callback API. This causes Coinbase to fetch a specified URL any time a wallet receives a transaction, and provides information on the transaction in the request. A Python script handles these requests and updates a running count of the BTC balance sent to the robot’s wallet.

On the hardware side, an Arduino with an Ethernet Shield checks the balance. If it has changed, it calls the dance function and the luau girl dances.

The robot sits in the window of the hackerspace, so anyone passing by can read about Bitcoin and make a donation. The source code is on Github, and a video follows after the break.

[Damien George] just created Micro Python (Kickstarter alert!), a lean and fast implementation of the Python scripting language that is optimized to run on a microcontroller. It includes a complete parser, compiler, virtual machine, runtime system, garbage collector and was written from scratch. Micro Python currently supports 32-bit ARM processors like the STM32F405 (168MHz Cortex-M4, 1MB flash, 192KB ram) shown in the picture above and will be open source once the already successful campaign finishes. Running your python program is as simple as copying your file to the platform (detected as a mass storage device) and rebooting it. The official micro python board includes a micro SD card slot, 4 LEDs, a switch, a real-time clock, an accelerometer and has plenty of I/O pins to interface many peripherals. A nice video can be found on the campaign page and an interview with the project creator is embedded after the break.

Page rankings are the secret sauce of websites that automatically aggregate user submissions. The basic formula used by Hacker News was published a few years back. But there are several pieces of the puzzle that are missing from that specification. [Ken Shirriff] recently published an analysis that digs deeper to expose the article penalization system used by Hacker News’ ranking engine.

One might assume that the user up and down votes are what determine a page’s lifespan on the front page. But it turns out that a complex penalization system makes a huge difference. It takes into account keywords, and domain names but also weighs controversy. It’s a bit amusing to note that this article on the topic was itself penalized, knocking it off of the front page.

You can get the full details of the system from his post, but we found his investigation methods to be equally interesting. He scraped two pages of the news feed every minute using Python and the Beautiful Soup package (a pretty common scraping practice). This data set allowed him to compare the known algorithm with actual results. What was left were a set of anomalies that contained enough sense for him to reverse engineer the unpublished formulas being used.

[Xiang] began by opening up two spare DVD writeable drives, salvaging not only their laser diodes but the stepper motors and their accompanying hardware, as well as a handful of small magnets near each diode. To assemble the laser, he sourced an inexpensive laser diode module from eBay and used a vise to push the diode into the head of the housing. With the laser snugly in place and the appropriate connecting wires soldered on, [Xiang] whipped up a laser driver circuit, which the Raspi will later control. [Xiang] worked out the stepper motors’ configuration by following [Groover’s] engraver build-(we featured it a few years back)-attaching the plate that holds the material to be engraved onto one axis and the laser assembly to the other.

Check out [Xiang’s] project blog for details explaining the h-bridge circuits as well as the Python code for the Raspi. As always, if you’re attempting any build involving a laser, please use all necessary precautions! And if you need more information on using DVD burners for their diodes, check out this hack from earlier in the summer