Using Gmail with OAUTH2 in Linux and on an ESP8266

One of the tasks I dread is configuring a web server to send email correctly via Gmail. The simplest way of sending emails is SMTP, and there are a number of scripts out there that provide a simple method to send mail that way with a minimum of configuration. There’s even PHP mail(), although it’s less than reliable.

Out of the box, Gmail requires OAUTH2 for authentication and to share user data, which has the major advantage of not requiring that you store your username and password in the application that requires access to your account. While they have an ‘allow less secure apps’ option that allows SMTP access for legacy products like Microsoft Outlook, it just doesn’t seem like the right way forward. Google documents how to interact with their API with OAUTH2, so why not just use that instead of putting my username and password in plaintext in a bunch of prototypes and test scripts?

Those are the thoughts that run through my head every time this comes up for a project, and each time I’ve somehow forgotten the steps to do it, also forgotten to write it down, and end up wasting quite a bit of time due to my own foolishness. As penance, I’ve decided to document the process and share it with all of you, and then also make it work on an ESP8266 board running the Arduino development environment.

Continue reading “Using Gmail with OAUTH2 in Linux and on an ESP8266”

Pogo Pins Make Light Work Of IoT Switches

Living in a condo with inadequate opportunity for fresh light wiring presented a problem for [Raphael Luckom], which he solved by taking a few off-the-shelf ESP8266-based IoT mains switches. That in itself is nothing particularly new these days, but what makes his switches special is that when faced with fiddly soldering to reprogram them, instead he fabricated a pogo pin jig to make the required contacts.

He took inspiration for his work from a Hackaday.io project hacking some Chinese switched outlets. They contain a standard ESP-12 module, so identifying the correct pins to program them was easy enough. He simply had to create a jig for his pogo pins, which he did with his 3D printer. Of course, “simply” is not an appropriate word, because along the way he had to pass through many iterations of the print, but eventually he had his jig secured to the boards with a clamp.

The result: a successful relay, and without the tricky soldering. We know many of our readers will have no problems with a bit of solder, but for those of you that don’t there might be a bit of interest here.

We’ve shown you many ESP8266 switches over the years. This all-in-one socket system was rather clever, but we’ve had some simple switches too.

Feed Your Cat The Modern Way

Feeding the cat should be a moment of magic, in which you bond with your adorable pet as she rubs seductively against your ankles. As you place the saucer of tender and moist meaty chunks on the floor, she bounds the length of your kitchen, excited expression on her little kitty face, and tail in the air.

If Hackaday made television adverts for cat food, we’d have it nailed. But our everyday reality involves the cute-as-heck Hackaday moggy turning into a persistent little pest when she decides it’s feeding time. [ThinkSilicon]’s friends had exactly this problem, with their furry friend’s preferred timing coming early in the morning. His solution? An automated cat feeder (translated) that dispenses kibbles from a hopper into the lucky mouser’s feeding dish.

The mechanical part of this endeavour is pretty straightforward, a servo moves a sliding piece of plywood with a hole cut in it across the bottom of a hopper full of cat food. Move the slide, dispense food down a chute to the waiting happy cat. Behind the scenes is an ESP8266 and a NodeMCU web service, through which feeding time can be either scheduled, or dispensed at will.

A happy cat means a happy owner, especially in the very early morning. Until that is the newly-sated creature decides to spread the love, jumping onto the owner’s bed in thanks and breathing cat-food-breath into their face. You really do have to love ’em!

We’ve shown you many cat food related projects in the past, including this Arduino take on the same idea. But why take the effort to trigger it yourself, when the cat can do it for you.

Minimizing ESP8266 Battery Drain

[Alex Jensen] wanted to build a battery-powered weather station, using an ESP8266 breakout board to connect to WiFi. However, [Alex]’s research revealed that the ESP chip uses around 70mA per hour when the radio is on — meaning that he’d have to change batteries a lot more than he wanted to. He really wanted a low power rig such that he’d only have to change batteries every 2 years on a pair of AAs.

The two considerations would be, how often does the ESP get powered up for data transmissions — and how often the weather station’s ATtiny85 takes sensor readings. Waking up the ESP from sleep mode takes about 16mA — plus, once awake it takes about 3 seconds to reconnect, precious time at 70mA. However, by using a static IP address he was able to pare that down to half a second, with one more second to do the actual data transmission. In addition to the hourly WiFi connection, the Tiny85 must be powered, though its relatively modest 1.5mA per hour doesn’t amount to much, even with the chip awake for 36 hours during the year. All told, the various components came to around 500 mAh per year, so using a pair of AA batteries should keep the rig going for years.

We’re intrigued by stories of hackers eking out every last drop of power to make their projects work. We’ve posted about ESPs low-power mode before, and what can be more low-power than a watch running off a coin cell?

Count YouTube Subscribers with this Red Play Button Award

Professional YouTubers live and die by the number of subscribers they have. It seems like a brutal way to make a living to us, but to each his own. Still, if you’re going to do it, you might as well do it right, and keeping track of how you’re doing with this Play Button Award subscriber counter might make sense. Or it might drive you nuts.

YouTuber [ibuynewstuff] has reached the vaunted 100,000 subscriber mark, the number required to earn the Silver Play Button award. Sadly, 100k is the bare minimum needed to get YouTube’s attention, and tales of waiting for months for the award to arrive are not uncommon. [ibuynewstuff] worked around the issue by 3D-printing his own temporary play button badge. Mounted to a picture frame with an ESP8266 and an 8 x 80 LED display behind a diffuser, [ibuynewstuff] can keep track of his progress toward the Gold Play Button award at 1,000,000 subs. Hopefully, his Silver award will arrive before then.

Want to replicate this but would rather have something a little more permanent than a plastic play button? Try casting your own Copper Play Button award.

Continue reading “Count YouTube Subscribers with this Red Play Button Award”

Spoof a Skimmer for Peace of Mind

It’s a sad commentary on the state of the world when it becomes a good practice to closely inspect the card reader on every ATM and gas pump for the presence of a skimmer. The trouble is, even physically yanking on the reader may not be enough, as more sophisticated skimmers now reside safely inside the device, sipping on the serial comms output of the reader and caching it for later pickup via Bluetooth. Devilishly clever stuff.

Luckily, there’s an app to detect these devices, and the prudent consumer might take solace when a quick scan of the area reveals no skimmers in operation. But is that enough? After all, how do you know the smartphone app is working? This skimmer scammer scanner — or is that a skimmer scanner scammer? — should help you prove you’re being as safe as possible.

The basic problem that [Ben Kolin] is trying to solve here is: how do you prove a negative? In other words, one could easily write an app with a hard-coded “This Area Certified Zebra-Free” message and market it as a “Zebra Detector,” and 99.999% of the time, it’ll give you the right results. [Ben]’s build provides the zebra, as it were, by posing as an active skimmer to convince the scanner app that a malicious Bluetooth site is nearby. It’s a quick and dirty build with a Nano and a Bluetooth module and a half-dozen lines of code. But it does the trick.

Need a primer on the nefarious world of skimming? Here’s an overview of how easy skimming has become, and a teardown of a skimmer captured in the wild.

A Minimalist Weather Clock with a Unique Display

If you’re looking for a home hub to display weather, time, and important family information, the formula is pretty simple: build yet another “magic mirror” project. We’re not complaining — magic mirrors look great. But if all you need is time and weather, this elegant pixel display is something just a little bit different.

Among his many criteria for the perfect hack, [Dominic] lists usefulness, visual appeal, and low cost. We’ll agree that his minimalist weather clock hits all those marks, and with the careful selection of a 16 x 32-pixel RGB display module, [Dominic] ended up giving back to the community by developing an Arduino driver for it. He points out that strips of Neopixels could have been used for the display, but they’d have ended up costing more, so the LED matrix was a sensible choice. A 3D-printed separator grid and a paper diffuser provide the proper pixelated look, and some simple animated icons display the two-day weather forecast. We find the time and temperature numerals a little hard to read, but it’s not bad considering the limited resolution of the display. And the case is a nice bit of woodworking too. Not a bad result for only €43.

We’re intrigued by the P10 LED matrix module [Dominic] used for this one. It might be a good choice for a word clock and weather station, or with his driver, a display for just about anything.