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”

Statistics and Hacking: A Stout Little Distribution

Previously, we discussed how to apply the most basic hypothesis test: the z-test. It requires a relatively large sample size, and might be appreciated less by hackers searching for truth on a tight budget of time and money.

As an alternative, we briefly mentioned the t-test. The basic procedure still applies: form hypotheses, sample data, check your assumptions, and perform the test. This time though, we’ll run the test with real data from IoT sensors, and programmatically rather than by hand.

The most important difference between the z-test and the t-test is that the t-test uses a different probability distribution. It is called the ‘t-distribution’, and is similar in principle to the normal distribution used by the z-test, but was developed by studying the properties of small sample sizes. The precise shape of the distribution depends on your sample size. Continue reading “Statistics and Hacking: A Stout Little Distribution”

Car Lights for Reflow Heat Source

If you only have a car and you need to unsolder some tricky surface mount components: what would you do? If you’re Kasyan TV, you’d remove your car’s halogen lights and get to town. That’s right: car lights for reflow.

When the friend of the host of Kasyan TV needed to remove some roasted toasted FETs from his motherboard but didn’t have anything for reflowing, she took some headlights and used them as an infrared source to desolder the FETs. Powered by a lab supply (although car batteries work too), the process works with 60 and 100-watt bulbs.

Now, reflowing with halogen bulbs isn’t new, and we’ve seen it done with the run of the mill 100-watt bulbs and a halogen floodlight. However, what we really like about using car lights is that they’re available everywhere and we already own some that we could (temporarily) repurpose. Now, don’t get us wrong – if you’re going to be reflowing more than just a little, there are plenty of alternative methods that don’t involve staring at “rather bright lights” for extended periods of time.

People ’round these parts can’t seem to get enough of reflow: from open source reflow oven controllers to reflowing with a hair straightener we’ve seen quite a bit. If you’re new to the reflow arena, we’ve got zero to hero: reflow style just for you. And if DIY at home reflow isn’t intense enough for you, we’ve got next level reflowing as well.

The full video is after the break, complete with Kasyan TV’s sponsored segment in the middle..

Continue reading “Car Lights for Reflow Heat Source”

The Incredible Shrinking Coin Cell Battery Pack

How’s it going with your project for the coin cell challenge? You can only use a single one, but Hackaday alum [Jeremy S Cook] has a great way to package coin cells into a sleek little power packs whether you need one, two, or even four.

[Jeremy] is building a wireless Wii nunchuk, so he needs a small battery that won’t short out or get punctured in the confines of the controller body. A single coin cell holder is already a bit bulky, and he needs to use two in series. He thought, why not try shrink wrapping them together? The only downside here is that the biggest tube that came with your average heat shrink multi-pack is probably a bit too tight to fit around them, so you might have to buy more (aw, shucks!).

After trying a few ways to make a good connection between the leads and the bare coin cell faces, [Jeremy] settled on generously stripping stranded wire and wrapping the long strands around the end to form a conductive swab. This slides in nicely between the coin cell and preshrunk tube. A little more heat will make a good connection, and some hot glue secures the wires. Click past the break for his build video and the other connection methods he tried. Have you come up with something better? Let us know in the comments.

Stray a bit further from the bench and you might come up with something like this googly eye battery holder we saw a few months ago.

Continue reading “The Incredible Shrinking Coin Cell Battery Pack”

Let There Be Automated Blinds!

More than once a maker has wanted a thing, only to find it more economical to build it themselves. When your domicile has massive windows, closing what can feel like a mile of blinds becomes a trial every afternoon — or every time you sit down for a movie. [Kyle Stewart-Frantz] had enough of that and automated his blinds.

After taking down and dismantling his existing roller blinds, he rebuilt it using 1-1/4 in EMT conduit for the blinds’ roll to mount a  12V electric shade kit within — the key part: the motor is remote controlled. Fitting it inside the conduit takes a bit of hacking and smashing if you don’t want to or can’t 3D print specific parts. Reattaching the roller blind also takes a fair bit of precision lest they unroll crooked every time. He advises a quick test and fit to the window before moving on to calibrating and linking all your blinds to one remote — unless you want a different headache.

Now, to get Alexa to do your bidding.

Continue reading “Let There Be Automated Blinds!”

Jeep Wrangler Dome Light Mod

If you’re the owner of a Jeep Wrangler, you may have experienced some frustration with the interior dome light. For those not in the know, removing the doors on a warm day or for a bit of fun can lead to a dead battery. This happens because the Wrangler’s light stays on unless the fuse or light are removed, or a custom shutoff switch is added — at the expense of troublesome wiring. You could say it’s a Jeep Thing. [Tim Nummy] offers a solution with minimal modifications.

First off, pop the switch out of the door and set it aside. As a replacement, [Tim Nummy] has managed to salvage a door light switch from an old Mercedes. In addition to the same momentary-off function as the Wrangler’s stock switch, the button on the new one can be pulled out and locked for a secondary off position. Many machines and appliances use this same type of switch in their safety interlocks as a service position. [Tim] didn’t want to cut apart the wiring in the Wrangler in case something goes awry down the line, so for now he has filed down some spade terminals to slot into the Mercedes plug. He’s also 3D printed a nut to nicely secure the new switch in place. Check out his how-to video after the break!

Continue reading “Jeep Wrangler Dome Light Mod”

Statistics and Hacking: An Introduction to Hypothesis Testing

In the early 20th century, Guinness breweries in Dublin had a policy of hiring the best graduates from Oxford and Cambridge to improve their industrial processes. At the time, it was considered a trade secret that they were using statistical methods to improve their process and product.

One problem they were having was that the z-test (a commonly used test at the time) required large sample sizes, and sufficient data was often unavailable. By studying the properties of small sample sizes, William Sealy Gosset developed a statistical test that required fewer samples to produce a reasonable result. As the story goes though, chemists at Guinness were forbidden from publishing their findings.

So he did what many of us would do: realizing the finding was important to disseminate, he adopted a pseudonym (‘Student’) and published it. Even though we now know who developed the test, it’s still called “Student’s t-test” and it remains widely used across scientific disciplines.

It’s a cute little story of math, anonymity, and beer… but what can we do with it? As it turns out, it’s something we could probably all be using more often, given the number of Internet-connected sensors we’ve been playing with. Today our goal is to cover hypothesis testing and the basic z-test, as these are fundamental to understanding how the t-test works. We’ll return to the t-test soon — with real data. Continue reading “Statistics and Hacking: An Introduction to Hypothesis Testing”