Broadcast Engineer at BellMedia, Computer history buff, compulsive deprecated, disparate hardware hoarder, R/C, robots, arduino, RF, and everything in between.
4146 stories
·
4 followers

This Is What Happens When You Hack a Casio Watch @travisgoodspeed #WearableWednesday #wearabletech #tech #smartwatch #DIY #hackers

1 Share

Get ready for the Goodwatch

The master of weird machines @travisgoodspeed has struck again with an amazing hack for a Casio watch, just in time for SchmooCon (FYI tickets are already sold out). As you might guess, the new GoodWatch20 does so much more than the original Casio. The wire on the back of the watch is the hint.

GoodWatch Antenna

If you guessed antenna, then you are correct! According to Travis the watch can receive and transmit everything from CW to 4FSK, which apparently is an upgrade from his previous GoodWatch10. Here’s a post from Twitter with a demo.

The watch uses a TI CC430F6137 microcontroller and has a hex editor, as well as an RPN calculator (for computer science lovers).  There’s also a TI MSP430 disassembler and the firmware has a serial debug monitor. If you want to follow the rest of the breadcrumbs to this amazing watch you should check out the pin on Twitter. Travis will be handing out a few unpopulated boards at SchmooCon and has promised to release the source code and CAD files soon. So, if anyone receives one of these boards, please check in as we would love an update. Note to Travis: thanks again for another mindblowing device for a con. #bloggingu4ever


Flora breadboard is Every Wednesday is Wearable Wednesday here at Adafruit! We’re bringing you the blinkiest, most fashionable, innovative, and useful wearables from around the web and in our own original projects featuring our wearable Arduino-compatible platform, FLORA. Be sure to post up your wearables projects in the forums or send us a link and you might be featured here on Wearable Wednesday!

Read the whole story
tekvax
2 days ago
reply
Burlington, Ontario
Share this story
Delete

Truly Terrible Dimensioned Drawings

1 Share

I’m in the planning stages of a side project for Hackaday right now. It’s nothing too impressive, but this is a project that will involve a lot of electromechanical parts. This project is going to need a lot of panel mount 1/8″ jacks and sockets, vertical mount DIN 5 connectors, pots, switches, and other carefully crafted bits of metal. Mouser and Digikey are great for nearly every other type of electrical component, but when it comes to these sorts of electromechanical components, your best move is usually to look at AliExpress or DealExtreme, finding something close to what you need, and buying a few hundred. Is this the best move for a manufacturable product? No, but we’re only building a few hundred of these things.

I have been browsing my usual Internet haunts in the search for the right bits of stamped brass and injection molded plastic for this project, and have come to a remarkable conclusion. Engineers, apparently, have no idea how to dimension drawings. Drafting has been a core competency for engineers from the dawn of time until AutoCAD was invented, and now we’re finally reaping the reward: It’s now rare to find a usable dimensioned drawing on the Internet.

This post is going to be half rant, half explanation of what is wrong with a few of the dimensioned drawings I’ve found recently. Consider this an example of what not to do.  There is no reason for the state of engineering drawing to be this bad.


Example One: It Gets Worse The More You Look At It

This first example comes from Bitches Love My Switches, an unfortunately-named storefront, but one that does have a lot of neat switches and jacks with a warehouse on the East Coast with quick shipping. If you want some jellybean parts for guitar pedals and associated audiophilia, it’s a nice place to know. This store doesn’t manufacture their own switches, and with that comes the problem of datasheets and dimension drawings. These drawings were made by a random engineer somewhere, and this person has no training in dimensioned drawings.

Let’s work through a design problem using the dimension drawing shown above. This is a PCB-mounted, switch, that is meant to have a nut holding it down to a panel. Think of it as a PCB standoff, only it’s a switch. This switch can be used as a mechanical, structural part of an enclosure.

To design anything using this switch, you need to know the height of every part of this switch, from where it attaches to the PCB, to where the nut will screw on. You need to know the height of the switch body. This dimension is completely absent in this drawing, making the drawing absolutely useless. The dimension you need to design anything using this switch is absent. But this drawing gets worse.

What if you wanted to know the height of the ‘toggle’ that physically moves in this switch. It’s labeled in the drawing as 9.5 mm, but this dimension is useless at best, and wrong with even the most liberal interpretation. Why? Because the toggle pivots. The tip of this toggle moves in an arc, and the tip will be ‘longer’ in the middle of its swing than it is in either of its latched positions. A real dimensioned drawing would include the 9.5 mm dimension and the angle of the toggle in the latched position so you can figure out the actual maximum height of the switch.

Want to hate this drawing even more? Sure thing. What sized nut goes on the threaded portion? Exactly. This isn’t a swing at the store selling these switches, but it is indicative of some terrible practices across the entire electronics industry. Somehow or another, everyone forgot how to create useful dimensioned drawings.


Example Two: All Loudspeaker Manufacturers Meet at Bohemian Grove

The project I’m working on will also need a speaker. The general specs are a 3-4 inch diameter speaker that can handle five Watts. I’m not looking for quality here, but I am looking for something I can design an enclosure for before I order it.

A speaker is a remarkably simple device. There’s a coil and a magnet, two terminals, a paper cone, and a metal flange with four holes around the perimeter of this flange, offset ninety degrees from each other. Nearly every generic loudspeaker will follow this prototype, and if you’re building an enclosure for a speaker, there are really only three things you need to know: the diameter of the hole you need to cut out, the depth of the speaker, and how far apart the screw holes on the flange are. I only need three dimensions here. I’m a simple man. I’m also extremely disappointed.

Mounting information for Celestion’s AN2075 loudspeaker. Guess what’s missing?

Celestion is a very highly regarded manufacturer of loudspeakers. They’ve been around for ninety years, they created the first metal-dome tweeter, and produce what is said to be the standard in guitar amp speakers. If you’re in the loudspeaker industry, Celestion is where you want to be. Surely they can come up with datasheets and tech specs that would be useful, right? Think again. Their AN2075 loudspeaker lists the overall depth of the speaker, the cut-out diameter, and the overall size of the of the speaker. How far apart are the mounting holes? Screw you, that’s how far apart they are. This isn’t even ‘drafting’ or ‘engineering drawing’. This is just incomplete information.

One of the better drawings of speaker dimensions on AliExpress

Celestion is not alone. Take a look at AliExpress. If you’re looking for small, cheap speakers that can handle ten or fifteen Watts, you have thousands of choices. Virtually none of them will have the relevant information on their product pages. Yes, you’ll usually get the dimensions of the flange, and you might get how deep the speaker actually is. You will rarely find where to put the screw holes on your project enclosure.

I’m not one to believe conspiracies. People are just too self-interested to be part of a cabal of evil bent on distorting the truth or ruling people. It’s the media theory of Chomsky versus Žižek; self-interest rules all. People are too stupid to organize. This may be the best evidence yet that conspiracies exist. There must be a conspiracy between loudspeaker manufactures. None of them have dimensions of where the holes should go.


Example Three: Jacks

This project will also make use of DIN 5 connectors (but not as MIDI jacks), and these must be panel mount connectors. Nearly every DIN 5 connector you’ll see on Mouser or Digikey is a right angle connector. That is to say, you solder the connector to the board, and the DIN 5 connector comes out at a right angle to the PCB. This isn’t what I want — I want a connector sticking straight up out of a board. Yes, these connectors exist, but again we’re left with incomplete dimensioned drawings, like the one I found on AliExpress below:

First, take a look at the photograph of the part. It’s what you would expect for a DIN 5 connector. There are five pins, and an additional grounding pin for the shield of the connector, just like every other DIN 5 connector on the planet. Take a look at the drawing. It’s actually not bad, and even gives me a preferred PCB footprint for five of the pins. But what about that grounding pin? It is absent on the dimensioned drawing. If you buy a thousand of these and run them through an assembly line, you’ll quickly find you have to snip off all the grounding pins before populating them into boards. The data is just missing, and you’re a fool if you engineer something directly from the drawings. You should be able to engineer something from the drawings, and this panel mount DIN 5 connector is a terrible product.


Any University That Has Dropped Their Drafting Class Is Doing A Disservice To Their Students

Since time immemorial until the late 90s and early 2000s, engineering drawing and drafting was a required course for all engineers. This is the class with T-squares and triangles and a hidden emphasis on developing fine motor control through lettering. Only a week or two of this class was devoted to dimensioned drawings, but this week is vital to all engineers. Your drawings are useless unless someone else can use them, and you can’t do that without properly dimensioned drawings.

I don’t know why I keep running into truly terrible dimensioned drawings. This is a required skill for all engineers, regardless if they’re educated in China, England, or the US. Yet it’s nonexistent everywhere except for the McMaster Carr catalog.

If you’d like to learn about how to make dimensioned drawings, I’d suggest picking up [French]’s Engineering Drawing. Yes, the book is 100 years old, but what it teaches hasn’t changed in 200 years. This is how the draftsmen for the Apollo Lunar Module learned how to draw. Yes, lettering is hard if you don’t have the right pencils and have underdeveloped fine motor control, but we’re using computers now anyway. Read this book, learn how to properly dimension drawings, and stop annoying engineers who are trying to build stuff.


Filed under: Engineering, Featured, Original Art, Rants















Read the whole story
tekvax
2 days ago
reply
Burlington, Ontario
Share this story
Delete

Using Gmail with OAUTH2 in Linux and on an ESP8266

1 Share

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.

Before we continue, now would be a good time for a non-technical refresher on how OAUTH works. The main differences between OAUTH and OAUTH2 are that the latter requires HTTPS, and the access tokens that allow an application to use specific services in a user account have an expiry.

To use Gmail with OAUTH2, we will need to start with five things: An application registered in the Google APIs, its client ID and client secret, a computer running LAMP (a by-the-hour VPS works just fine here), and a domain name that points to it.

Registering an application with Google API is easy. Go to the Google API console, log in, create a new project, and enter it. Enable the Gmail API; it should be suggested on the front page.

With the project created and the Gmail API enabled, the dashboard should look something like this

Then click on ‘credentials’ on the sidebar, create credentials, and finally ‘create OAUTH Client ID’. Before you can continue, you need to create a consent screen. The only entry you really need to fill out at this time is ‘Product Name Shown to Users’.

After saving that form, select ‘Web Application’ as your application type. Note the field called ‘Authorized redirect URIs’, we’ll return to it later. It’s important that it be correctly set for us to be able to receive a refresh token later on in this process.

For now, just press ‘Create’. A pop-up will display containing your Client ID and Client secret. You’ll need them soon, so best to copy/paste them into a local file on your computer for now.

Next, we will use those two pieces of data to request an access token and refresh token. We may as well accomplish two things at the same time here by installing the popular PHP email sender called PHPMailer on our web server. It includes a tool to request an OAUTH2 access/refresh token as well as being easily capable of sending a quick test email. To install it, we’ll use the Composer PHP dependency management tool:

$sudo apt-get install composer

Then we should navigate to our web-accessible directory, in my case /var/www/html, and install a few PHP scripts. Note that this should not be done as root, so create another user if needed and give them access to the directory:

$composer require phpmailer/phpmailer
$composer require league/oauth2-client
$composer require league/oauth2-google

Now enter the directory vendor/phpmailer/phpmailer. There will be a script called get_oauth_token.php. Move this script up three directories into the directory you just ran the ‘composer’ commands from. The location of this script as seen from the web needs to be entered into the ‘Authorized redirect URIs’ field of the Google API that we saw earlier. In this case it would have been https://mydomain.com/get_oauth_token.php. Public IP addresses will not work, this is why a domain name pointed to your web server is a requirement.

Now, open get_oauth_token.php in a text editor and paste in your Client ID and Client Secret where needed. Don’t try to run the script locally, it will fail. Open up a web browser on any computer, and navigate to the URL you entered as the ‘Authorized redirect URI’. Then select Google from the list of email services – at this point if it worked you will be asked to log in and then authorize the unverified application, under ‘Advanced’ under the warning prompt, at which point you will finally receive a refresh token. If you only want an access token for some reason you’ll have to edit the script to echo it back.

If that didn’t work, there are two common reasons: a wrong redirect URI or the script cannot find its dependencies. In the former case, the error message from Google will tell you the script URL as it sees it, and you can use that information to update the redirect URI in the Google API Console to fix the issue. For the latter, check your apache error log, probably located in /var/log/apache2/error.log, to see what dependency is not being found. You might see something like this:

PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/mydomain/get_oauth_token.php on line 59, referer: http://mydomain.com/get_oauth_token.php

If you have received your refresh token, congratulations: the painful part is over. You can just go to the PHPMailer Github page and fill out their OAUTH2 example (gmail_xoauth.phps), and it ought to just work. If all you needed to do is send mail from a project on your VPS, you’re more or less ready to move on to more interesting parts of your project:

$email = 'someone@gmail.com';
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
//Obtained by configuring and running get_oauth_token.php
//after setting up an app in Google Developer Console.
$refreshToken = 'RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0';

Remember to clean up any unnecessary scripts that contain your refresh token and other sensitive data before continuing.

ESP8266: We Don’t Need No Stinking Servers

Now what if we wanted to use these tokens to send email directly from project on a Raspberry Pi without needing a server in the middle? It turns out that once we have the client ID, client secret, and refresh token, we no longer require the server and domain name we’ve been using so far, and a mail-sending application, e.g. PHPMailer, can be installed on a computer anywhere with Internet access as long as it is configured with those values.

Things get a little more complicated when we try to do this on an ESP8266. OAUTH2 requires that we use SSL, and access tokens regularly expire and need to be refreshed. Thankfully, [jalmeroth] generously wrote a proof-of-concept and published it on GitHub. If provided with an access token, it can access your Gmail account and use it to send an email. It can also directly update/get data from Google Sheets, but I didn’t test this. However, if the access token was expired, it couldn’t detect that, although it did include working code to actually request a new token, but not parse it out and use it.

In an attempt to add to the functionality of that proof of concept, I forked the project and made a few changes. First, I changed to order of operations in the code to make it check if the current access token was valid before doing anything else. Second, Google API was responding ‘400 Bad Request’ if the access token was invalid, and everything but ‘200 OK’ responses were being filtered out by the code. Finally, I wrote a couple of JSON parsers that check the reason for the ‘400 Bad Request’ and extract and use the access token returned by Google API when a new one is requested.

It works, but it’s hardly reliable – not surprising considering I’ve never really used the Arduino platform before. Notably, the SHA1 fingerprint for Google API fails often. Checking from my local machine, the SHA1 fingerprint varies between two signatures there too. It would be fairly easy to check for either of them, or just keep trying, but I’d rather understand what’s going on first. (Is it just a CDN or something else?) Or perhaps I should rewrite the whole application in Lua where I’m more competent.

A fun little application built on the above was to place a button on my office that sends an email to my phone. I don’t want people to contact me at that email address frivolously, but do want to know immediately if someone is waiting outside my office. The big red button is for normal requests, but urgent requests require lockpicking. If it’s urgent it better also be interesting.

Finally, did you know that Hackaday provides an API for accessing hackaday.io? It uses the simpler OAUTH (not OAUTH2) authentication, so should be more straightforward than the above to implement on the ESP8266. Have any of you used it?


Filed under: Arduino Hacks, google hacks, how-to, Original Art











Read the whole story
tekvax
2 days ago
reply
Burlington, Ontario
Share this story
Delete

Roy Moore continues to defy reality

2 Shares

After losing the Alabama special senate election two days ago, Roy Moore remains stuck in the Denial stage of the Kubler-Ross Model of Grief. In a cartoonishly self-important video statement released this morning, Moore's eyes unwaveringly tracked a teleprompter while he recited, "We are indeed in a struggle to preserve our republic, our civilization, and our religion, and to set free a suffering humanity. In this race, we have not received the final count​ to include ​military and provisional ballots. This has been a very close race and we are awaiting certification by the secretary of state."

Is it really that surprising that a man who was banned from a shopping mall to stop him from pursuing teenage girls would refuse to bow out gracefully from an election he lost?

Alabama's Secretary of State winner said the election winner Doug Jones' chances of not being certified were "highly unlikely."

Read the whole story
tekvax
2 days ago
reply
Burlington, Ontario
Share this story
Delete

Patreon decides not to change fee structure: "We messed up"

1 Share

Following a backlash against planned fee increases, Patreon is backing down. For now, everything will stay the way it is.

We’ve heard you loud and clear. We’re not going to rollout the changes to our payments system that we announced last week. We still have to fix the problems that those changes addressed, but we’re going to fix them in a different way, and we’re going to work with you to come up with the specifics, as we should have done the first time around. Many of you lost patrons, and you lost income. No apology will make up for that, but nevertheless, I’m sorry. It is our core belief that you should own the relationships with your fans. These are your businesses, and they are your fans.

I’ve spent hours and hours on the phone with creators, and so has the Patreon team. Your feedback has been crystal clear:

The new payments system disproportionately impacted $1 – $2 patrons. We have to build a better system for them.

Aggregation is highly-valued, and we underestimated that.

Fundamentally, creators should own the business decisions with their fans, not Patreon. We overstepped our bounds and injected ourselves into that relationship, against our core belief as a business.

Read the whole story
tekvax
3 days ago
reply
Burlington, Ontario
Share this story
Delete

You can run DSL over wet string

1 Share

ADSL was a miracle when it debuted, delivering high speeds over old copper, thanks to a protocol that was so adaptable to suboptimal media that it was said it could run "over a piece of wet string." (more…)

Read the whole story
tekvax
3 days ago
reply
Burlington, Ontario
Share this story
Delete
Next Page of Stories