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”

Guitar Game Plays with Enhanced Realism

There’s a lot more to learning how to play the guitar than just playing the right notes at the right time and in the right order. To produce any sound at all requires learning how to do completely different things with your hands simultaneously, unless maybe you’re a direct descendant of Eddie Van Halen and thus born to do hammer ons. There’s a bunch of other stuff that comes with the territory, like stringing the thing, tuning it, and storing it properly, all of which can be frustrating and discouraging to new players. Add in the calluses, and it’s no wonder people like Guitar Hero so much.

[Jake] and [Jonah] have found a way to bridge the gap between pushing candy colored buttons and developing fireproof calluses and enough grip strength to crush a tin can. For their final project in [Bruce Land]’s embedded microcontroller design class, they made a guitar video game and a controller that’s much closer to the experience of actually playing a guitar. Whether you’re learning to play for real or just want to have fun, the game is a good introduction to the coordination required to make more than just noise.

Continue reading “Guitar Game Plays with Enhanced Realism”

Generate Random Numbers The Hard Way

Your job is to create a random number generator.

Your device starts with a speaker and a membrane. On this membrane will sit a handful of small, marble-size copper balls. An audio source feeds the speaker and causes the balls to bounce to and fro. If a ball bounces high enough, it will gain the opportunity to travel down one of seven copper tubes. Optical sensors in each of the tubes detect the ball and feed data to an Ardunio Mega. When the ball reaches the end of the tube, a robotic hand will take the ball and put it back on the speaker membrane. The magic happens when we write an algorithm such that the audio output for the speaker is a function of how many balls fall down the pipes.

The above is a rough description of [::vtol::]’s art piece: kinetic random number generator. We’re pretty sure that there are easier ways to get some non-determinstic bits, but there may be none more fun to watch.

[::vtol::] is a frequent flyer here on Hackaday Airlines. Where else would you showcase your 8-bit Game Boy Photo Gun or your brainwave-activated ferrofluid monster bath? Would it shock you to find out that we’ve even covered another kinetic random number generator of his?  Fun stuff!

Keep Track Of Your Weight While Sleeping

When the average person looks at a bed, they think about sleeping. Because that’s what beds are for. You cover them with soft, warm cloths and fluffy pillows and you sleep on them. [Peter] is not your average person. He’s a maker. And when he looks at a bed, he thinks about giving it the ability to track his weight.

The IKEA bed has four Chinese-made TS-606 load cells under each foot with custom aluminum enclosures. Each one goes to an HX711 analog-to-digital converter, which offers a 24 bit resolution. These feed an Arduino Nano which in turns connects to a Raspberry Pi via USB to UART bridge. Connecting to the Pi allows [Peter] to get the data onto his home network, where he plots the data to gnuplot.

This smart bed doesn’t just track [Peter’s] weight. It can also track the weight of other people in the house, including his pets. Be sure to check his GitHub for full source code.

Laser Cutter Alignment Mod Skips Beam Combiner

A lot of the DIY laser engravers and cutters we cover here on Hackaday are made with laser diodes salvaged from Blu-ray drives and projectors, which are visible lasers in the 400 – 450nm range (appearing as violet or blue). Unfortunately there is an upper limit in terms of power on visible diode lasers, most builds max out at 5W or so. If you need more power than that, you’ll likely find yourself looking at gas laser cutters like the K40. While the K40 is a great starting point if you’re looking to get into “real” lasers, it’s a very different beast from the homebrew builds using visible lasers.

With a gas laser the beam itself is invisible, making it much more difficult to align or do test runs. One solution is to add a visible laser to the K40 which can be used to verify alignment, but making sure it’s traveling down the same path as the primary laser usually requires an expensive beam combiner. Looking to avoid this cost, [gafu] wanted to see if it was possible to simply move the visible laser into the path of the primary beam mechanically.

An adjustable microswitch detects when the lid has been opened.

In the setup that [gafu] has come up with, a cheap laser module (the type from a handheld laser pointer) is moved into the path of the primary laser on an arm that’s actuated by a simple hobby servo. To prevent the primary and visible lasers from firing at the same time, an Arduino is used to control the servo given the current state of the K40’s lid. If the lid of the K40 is open, the primary laser is shutoff and the visible laser is rotated into position so the operator can see where the primary laser’s beam would be hitting. Once the lid is closed, the visible laser rotates out of the way and the primary is powered back up.

Running the cutting or engraving job with the lid of the K40 machine open now let’s [gafu] watch a “dry run” of the entire operation with the visible laser before finally committing to blasting the target with the full power beam.

We’ve covered many hacks and modifications for everyone’s favorite entry-level CO2 laser cutter. From replacing the controller to making it bigger, K40 owners certainly seem like a creative bunch.

The Internet of Blast Gates

There’s nothing quite like building out a shop filled with tools, but even that enviable task has a lot of boring work that goes into it. You’ve got to run power, you’ve got to build benches, and you need to build a dust collection system. That last one is usually just fitting a bunch of pipe and tubes together and adding in a few blast gates to direct the sucking of your dust collection system to various tools around the shop.

For most shops with a handful of tools and dust collection ports, manually opening and closing each blast gate is an annoying if necessary task. What if all of this was automated, though? That’s what [Bob] over on I Like To Make Stuff did. He automated his dust collection system. When a tool turns on, so does the vacuum, and the right blast gate opens up automatically.

The first part of this build is exactly what you would expect for installing a dust collection system in a shop. The main line is PVC sewer pipe tied to the rafters. Yes, this pipe is grounded, and s otherwise not very interesting at all. The real fun comes with the bits of electronics. [Bob] modified standard blast gates to be servo-actuated. Each individual tool was wired up to a current sensor at the plug, and all of this was connected to an Arduino. With a big ‘ol relay attached to the dust collection system, the only thing standing in the way of complete automation was a bit of code.

This project is a continuation of [Bob]’s earlier Arduinofication of his dust collection system where all the blast gates were controlled by servos, an Arduino, and a numeric keypad. That’s an exceptionally functional system that gets around the whole ‘leaning over a machine to open a gate’ problem, but it’s still not idiot-proof – someone has to press a button to open a gate. This new system is, for the most part, completely automatic and doesn’t really require any thought on the part of the operator. It’s neat stuff, and a great application of cheap Arduinos to make shop life a bit easier.

Continue reading “The Internet of Blast Gates”

A Bluetooth Speaker For Babies

[Mike Clifford] of [Modustrial Maker] had not one, not two, but five friends call him to announce that their first children were on the way, and he was inspired to build them a Bluetooth speaker with a unique LED matrix display as a fitting gift. Meant to not only entertain guests, but to audio-visually stimulate each of their children to promote neurological development.

Picking up and planing down rough maple planks, [Clifford] built a mitered box to house the components before applying wood finish. The brain inside the box is an Arduino Mega — or a suitable clone — controlling a Dayton Bluetooth audio and 2x15W amp board. In addition to the 19.7V power supply, there’s a step down converter for the Mega, and a mic to make the LED matrix sound-reactive. The LED matrix is on a moveable baffle to adjust the distance between it and a semi-transparent acrylic light diffuser. This shifts the light between sharp points or a softer, blended look — perfect for the scrolling Matrix text and fireplace effects! Check it out!

Continue reading “A Bluetooth Speaker For Babies”