Print From The ESP8266, Courtesy Of Google

The ESP8266 has become the hacker’s microcontroller of choice because it’s exceptionally easy to get the chip connected to the network and talking to other devices. The fact that it’s also absurdly cheap is just a bonus. Since nearly every piece of electronics you buy today is “smart” enough to include some form of Internet control, that means there’s no shortage of gadgets these MCUs can potentially poke and prod.

In their latest tip, [TecnoProfesor] shows how you can interface the ESP8266 with Google’s Cloud Print, a service that enables simple remote printing over the web without having to worry about having the proper device drivers. Remote printing from the ESP8266 might seem like little more than a gag at first glance, but if you’re the kind of person who likes to have hard copies of data, adding the capability to generate a daily printed report to your weather station could be a nice weekend project.

[TecnoProfesor] provides explanations and source code for printing documents of various sizes from both the ESP8266’s internal flash storage and an SPI-attached SD card. Towards the end of the write-up, there’s even some explanation of how the setPrintDocument() function of the Cloud Print API can be used in more advanced scenarios, such as printing web pages or documents stored in Google Drive.

When we see microcontrollers connected to printers, they’re usually of the small thermal kind. Being able to access “real” printers with such a simple technique offers some interesting possibilities, though like most technology, there’s potential for it to be misused.

[Thanks to Andrew for the tip.]

AI Poised To Turn The Internet Into Gibberish

Last Thursday two lowly masters grad students, Aaron Gokaslan and Vanya Cohen managed to replicate the secretive OpenAI model and cheekily named their version OpenGPT-2. The code can be downloaded from this Google Colab page and apparently no prior experience in language modeling is required to use it. More useful might be the skills required to persuade Google to part with $50,000 worth of free cloud compute time for the training!

Research firm OpenAI released a new, ever more powerful, version of their GPT language model with 1.5 billion parameters, trained on a data-set of 8 million web pages and although it’s most entertaining use is to produce gibberish, it will inevitably also be able to produce coherent text sometime very soon. For us mere mortals, there’s a cut down version of the model hosted in the cloud and a webpage that we can visit, type in a short phrase to prompt the system, and print out a few paragraphs of fake news. We tried it with the following: “You can use an Arduino to” and the results were:

  • You can use an Arduino to remove your appendix. Use an open or closed loop, but do not use them at the same time, i.e. don’t wire your Arduino to the wall like I did. The Arduino’s are very noisy and can damage the circuit board. Be sure to use a good quality and high-quality resistor to connect them to the wall. You can also use your own antenna if you’d like.

The neural network works by taking the text that has been previously printed and using this to predict the next word sequentially. Because of it’s obscurity, our Arduino example is a pretty severe and rather unfair test on the system whilst in it’s fledgling infant state and, looking at the proper metrics, it actually performs quite well on certain standard industry test sets such as the Children’s Book Test.

Be sure to paste your own fake news into the comments below and we’ll take a vote on the one that’s most entertaining, but please keep it within the boundaries of good taste!

Whilst this is an emerging technology, somebody did get hold of it a while back and applied it to an old teleprinter!

 

Interactive Demo Shows The Power Of Fourier Transforms

When it comes to mathematics, the average person can probably get through most of life well enough with just basic algebra. Some simple statistical concepts would be helpful, and a little calculus couldn’t hurt. But that leaves out a lot of interesting mathematical concepts that really do have applications in everyday life and are just plain fascinating in their own right.

Chief among these concepts is the Fourier transform, which is the key to understanding everything from how JPEGs work to how we can stream audio and video over the Internet. To help get your mind around the concept, [Jez Swanson] has this interactive Fourier transform visualizer that really drives home the important points. This is high-level stuff; it just covers the basic concepts of a Fourier transform, how they work, and what they’re good for in everyday life. There are no equations, just engaging animations that show how any function can be decomposed into a set of sine waves. One shows the approximation of a square wave with a slider to control to vary the number of component sine waves; a button lets you hear the resulting sound getting harsher as it approaches a true square wave. There’s also a great bit on epicycles and SVGs, and one of the best introductions to encoding images as JPEGs that we’ve seen. The best part: all the code behind the demos is available on GitHub.

In terms of making Fourier transform concepts accessible, we’d put [Jez]’s work right up there with such devices as the original Michelson harmonic analyzer, or even its more recent plywood reproduction. Plus the interactive demos were a lot of fun to play with.

[via the Adafruit blog]

Stalking Last.fm Streams On Spotify

Back in the early days of social media and Web 2.0, Last.fm was one of the premier music sites on the internet. With a huge library containing what felt like every song ever, along with an excellent algorithm for recommending new tracks, it quickly gained a large following. Unfortunately, its business model and following changed over the years, but there’s still a diehard userbase. [Hexalyse] was unhappy with Spotify’s algorithms, so built a tool to allow her to shadow what Last.fm users were listening to in real time.

Last.fm’s major feature is that it allows you to tell others what you’re listening to, by “scrobbling” your tracks as you play them. It’s possible to scrape this live data from any user via the Last.fm API, making the project possible. [Hexalyse] whipped up a Python script to query a selected user’s current playing track via Last.fm, before then handing the song data to the Spotify API to play the music locally.

It’s a fun way to find new music, relying on human taste rather than a pile of data center algebra. [Hexalyse] has uploaded the code to Github if you’re eager to try it for yourself. Of course, you get bonus points if you integrate it with Spotify on the Macintosh SE/30.

Yes, You Can Put IoT On The Blockchain Using Python And The ESP8266

Last year, we saw quite a bit of media attention paid to blockchain startups. They raised money from the public, then most of them vanished without a trace (or product). Ethics and legality of their fundraising model aside, a few of the ideas they presented might be worth revisiting one day.

One idea in particular that I’ve struggled with is the synthesis of IoT and blockchain technology. Usually when presented with a product or technology, I can comprehend how and/or why someone would use it – in this case I understand neither, and it’s been nagging at me from some quiet but irrepressible corner of my mind.

The typical IoT networks I’ve seen collect data using cheap and low-power devices, and transmit it to a central service without more effort spent on security than needed (and sometimes much less). On the other hand, blockchains tend to be an expensive way to store data, require a fair amount of local storage and processing power to fully interact with them, and generally involve the careful use of public-private key encryption.

I can see some edge cases where it would be useful, for example securely setting the state of some large network of state machines – sort of like a more complex version of this system that controls a single LED via Ethereum smart contract.

What I believe isn’t important though, perhaps I just lack imagination – so lets build it anyway.

Continue reading “Yes, You Can Put IoT On The Blockchain Using Python And The ESP8266”

Hack Your Gmail: A Quick Start For Google App Scripting

For many people, Gmail is synonymous with e-mail. Some people like having cloud access to everything and some people hate having any personal data in the cloud. However you feel about it, one thing that was nice about having desktop software is that you could hack it relatively easily. If you didn’t like how your desktop mail client worked, you had a lot of options: use a different program, write your own, hack the executable of your current program, or in the case of open source just fork it and make any changes you are smart enough to make.

Google provides a lot of features with all of its products, but however you slice it, all the code runs on their servers out of your reach. Sort of. If you know JavaScript, you can use Google Apps Script to add features to many Google products including Gmail. If you’ve used Office scripting, the idea is the same, although obviously the implementation is very different.

With scripting you can make sophisticated filters that would be very hard to do otherwise. For example,  monitor for suspicious messages like those with more than 4 attachments, or that appear to come from a contact between the hours of 2AM and 5AM.

For our example today, I’m going to show you something that is easy but also highly useful.

Continue reading “Hack Your Gmail: A Quick Start For Google App Scripting”

IPv6 Christmas Display Uses 75 Internet’s Worth Of Addresses

We’ve seen internet-enabled holiday displays before, and we know IPv6 offers much more space than the older IPv4 addressing scheme that most of us still use today, but the two have never been more spectacularly demonstrated than at jinglepings.com. The live video stream shows an Internet-connected Christmas tree and an LED display wall that you can control by sending IPv6 ICMP echo request messages, more commonly known as pings.

Reading the page, you quickly parse the fact that there are three ways to control the tree. First, you can type a message in the box and press send – this message gets displayed on the crawl at the bottom of the LED screen.  Second, you can light up the tree by sending a ping to the IPv6 address 2001:4c08:2028:2019::RR:GG:BB, where RR, GG, and BB are 8-bit hex values for red, green, and blue. This is a neat abuse of the IPv6 address space, in that the tree has 224 (around 16.8 million) IPv6 addresses, one for each color you can set. We were impressed by this brute-force use of address space, at least until we read on a little further.

You can also make your own drawings on the LED wall, again by sending pings. In this case, the address to set a pixel to a particular color is: 2001:4c08:2028:X:Y:RR:GG:BB, where X and Y are the pixel coordinates. This seems easy enough: to set pixel (10, 11) to magenta, the RGB value (0xFF, 0x00, 0xFF), you’d simply ping the IPv6 address 2001:4c08:2028:10:11:FF:00:FF. Having  an array of addressable LEDs is commonplace in hacker circles today, although each of them having their own live IPv6 address on the Internet seems a little excessive at first. Then it hits you – each LED has an IPv6 address for every possible color, just like the tree: 16.8 million addresses for each LED. The LED display is 160×120 pixels in size, so the total number of IPv6 addresses used is 160x120x224, which is 75 times larger than all possible IPv4 addresses!  This is a hack of monstrous proportions, and we love it.

In case you’re not running IPv6 yet, we’ve got you covered. To send individual pings using your browser, you can use a site like Ipv6now. If you want to send pixels to the display wall, you’re better off using a 6in4 tunnel that lets you access IPv6 sites using your current IPv4 connectivity.  Hurricane Electric offers a free 6in4 tunnel service that we’ve found useful. Then it’s just a matter of writing some code to send pixel values as pings.  The python scapy module is perfect for this sort of thing. But, first you’ll have to fill out the form on jinglepings.com and wait to get your IPv6 address whitelisted before you can draw on the display; evidently the usual bad actors have found the site and started drawing inappropriate things.

If you think this use of addresses seems wasteful, you needn’t worry. There are around 3.4×1038 IPv6 addresses, enough for 1027 such displays. We’re going to go out on a limb here and say it: nobody will ever need more than 2128 IP addresses.

If you’re looking to build an LED holiday display on a smaller budget, check out this one that re-purposes normal LED strings.

Thanks to [Ward] for the tip!