Encoders Spin Us Right Round

Rotary encoders are great devices. Monitoring just a few pins you can easily and quickly read in rotation and direction of a user input (as well as many other applications). But as with anything, there are caveats. I recently had the chance to dive into some of the benefits and drawbacks of rotary encoders and how to work with them.

I often work with students on different levels of electronic projects. One student project needed a rotary encoder. These come in mechanical and optical variants. In a way, they are very simple devices. In another way, they have some complex nuances. The target board was an ST Nucleo. This particular board has a small ARM processor and can use mbed environment for development and programming. The board itself can take Arduino daughter boards and have additional pins for ST morpho boards (whatever those are).

The mbed system is the ARM’s answer to Arduino. A web-based IDE lets you write C++ code with tons of support libraries. The board looks like a USB drive, so you download the program to this ersatz drive, and the board is programmed. I posted an intro to mbed awhile back with a similar board, so if you want a refresher on that, you might like to read that first.

Reading the Encoder

The encoder we had was on a little PCB that you get when you buy one of those Chinese Arduino 37 sensor kits. (By the way, if you are looking for documentation on those kinds of boards, look here.; in particular, this was a KY-040 module.) The board has power and ground pins, along with three pins. One of the pins is a switch closure to ground when you depress the shaft of the encoder. The other two encode the direction and speed of the shaft rotation. There are three pull-up resistors, one for each output.

I expected to explain how the device worked, and then assist in writing some code with a good example of having to debounce, use pin change interrupts, and obviously throw in some other arcane lore. Turns out that was wholly unnecessary. Well… sort of.

Continue reading “Encoders Spin Us Right Round”

Friday Hack Chat: Eagle PCB Design With Matt Berggren

Eagle is a household name for all Hackaday regulars. Here’s your chance to learn about upcoming features, get your ‘how do I do this in Eagle?’ questions answered, and get your wishlist items heard. Join us on Friday at 12:00 PST for a live Hack Chat about the Eagle PCB Design software.

Hosting this week’s discussion is [Matt Berggren], also known on Hackaday.io as technolomaniac. Matt is the Director of Autodesk Circuits and with Autodesk’s acquisition of Eagle last summer, the popular schematic design and PCB layout software falls under his purview. He has an extensive background in designing printed circuit boards — if you can do it in EDA software he knows how — this is an excellent opportunity to get answered the questions that have been stumping you.

Don’t miss this Hack Chat! Here’s a handy web tool to help convert 1/13/17 at 12:00 PST to your local time.

Here’s How to Take Part:

join-project-team-message-buttons
Buttons to join the Hacker Channel and enter Hack Chat

Hack Chat are live community events that take place in the Hackaday.io Hacker Channel. Visit that page (make sure you are logged in) and look for the “Join this Project Button” in the upper right. Once you are part of the Hacker Channel, that button will change to “Team Messaging” which takes you to the Hack Chat.

You don’t have to wait for Friday, join Hack Chat whenever you like and see what the community is currently talking about.

Join Us Next Week Too for KiCad!

Are you more of a KiCad person than an Eagle person? You should still drop by this week to see if Matt changes your mind. But block out your calendar next week when [Wayne Stambaugh], one of the lead developers of KiCad will join us for a Hack Chat on Friday, 1/20/17.

Socks By Bob

No, this article is not about SOCKS4 or SOCKS5 or Proxies. It’s about real socks, the ones that go onto your feet. Meet [Bob Rutherford], 88 years old, who lives in Saskatoon, Canada. He and his gang ([Glynn Sully], 92 years old , [George Slater] 85 year old, and young [Barney Sullivan] 65 years old) have made 10,000 socks for shelters in the community and across the country. That’s almost 8 miles of socks. Last year alone “operation Socks by Bob” as he likes to call it, produced 2,000 socks.

So how did these 4 fellows manage to pull this off? Turns out that [Bob] has a bit of a maker spirit in him and he actually built a fast, cheap, knitting machine for the purpose of making socks. Using a sewer tubing as a base, the machines can knit at 90 stitches a second.

He made it a while back but it didn’t have much of a use in mind for it. Sadly, seven years ago his wife passed away, leaving him facing a void in his life. Following his son advice “If you want to help yourself, help somebody else”, he decided to start this project.

“There’s a lot of us, as we grow older, we sit at home and look at the wall with nothing to do! Socks by Bob has given me that something to do.” [Bob]

Nowadays the gang has 2 machines working steadily and, once a week, they cut the long tubes of wool into socks. Half the yarn is donated, the other plus shipping costs are raised by [Bob’s] son. The knitting machines look pretty awesome in action. See for yourself in the video below.

Continue reading “Socks By Bob”

Pulsed Power And Its Applications

Pulsed power is a technology that consists in accumulating energy over some period of time, then releasing it very quickly. Since power equals energy (or work) divided by time, the idea is to emit a constant amount of energy in as short a time as possible. It will only last for a fraction of a second though, but that instantaneous power has very interesting applications. With this technology, power levels of more than 300 terawatts have been obtained. Is this technology for unlimited budgets, or is this in reach of the common hacker?

Consider for example discharging a capacitor. A large 450 V, 3300 uF electrolytic capacitor discharges in about 0.1 seconds (varies a lot depending on capacitor design). Since the energy stored in it is given by 1/2 CV², which gives 334 Joules of energy, the power delivered will be 3340 watts. In fact a popular hacker project is to build large capacitor banks. Once you have the bank, and a way to charge it, you can use it to power very interesting devices such as:

untitled1
A portable, 1.25 kJ coilgun by [Jason Murray]

Railguns in particular are subject to serious research. You may have read about the navy railgun, capable of reaching a muzzle speed of more than 4,600 mph (around Mach 6), more than any other explosive-powered gun. Power is provided by a 9-megajoule capacitor bank. The capacitors discharge on two conducting rails, generating an electromagnetic field that fires the projectile along the rails. The rail wear due to the tremendous pressures and currents, in the millions of amperes range, is still a problem to be solved.

Continue reading “Pulsed Power And Its Applications”

Full-Auto Crossbow Rocks And Rolls On Rubber Bands And Electric Drill

You’ve got to enjoy any project where the hacker clearly loves what he or she is doing. And when the project is as cool as a motor-driven, rubber band powered, fully automatic crossbow, it’s hard not to laugh along.

A full-auto crossbow is no mean feat, and it took a man with a love for rubber-powered firearms to get it right. [JoergSprave]’s design is based on a rack-and-pinion system and executed mainly in plywood. The main pinion gear is a composite of aluminum and wood, in a bid to increase the life of the mechanism and to properly deal with the forces involved. The pinion, turned by a powerful electric drill, drives the rack back and locks the carrier under the 30-bolt magazine. A rubber-powered follower forces a bolt down and a cam on the pinion trips the sear, the bolt is fired and the cycle continues.

We slowed the video down a bit and it looked to us like the cyclical rate of fire was about 7 rounds per second, or a respectable 420 rounds per minute. Pretty powerful, too, and the accuracy isn’t bad either.

We’ve seen [Joerg]’s inventions before, like this soda bottle Gatling arrow launcher, or his ridiculous machete launcher. We hope he keeps having fun and letting us watch.

Continue reading “Full-Auto Crossbow Rocks And Rolls On Rubber Bands And Electric Drill”

Super Mario Run(s) — Away With Your Money

If you are an Android user and a big fan of Super Mario beware: there is no Android version! There has been no official news on the Android version yet, let alone a version of the game. There is, however, a version circulating outside of Google Play market that will steal your bank account.

Right now attackers are taking advantage of the game’s popularity and Android users despair to spread malware posing as an Android version of Super Mario Run as they did in the past for Pokemon GO. The trojan is called Android Marcher and has been around since 2013, mostly targeting mobile users financial information. After installation, the application attempts to trick users with fake finance apps and a credit card page in an effort to capture banking details. The malware also locks out Google Play until the user supplies their credit card information.

In this new variant of Marcher, it can monitor the device and steal login data of regular apps, not just banking and payment apps, and send the stolen data back to command and control (C&C) servers. Facebook, WhatsApp, Skype, Gmail, the Google Play store are all vulnerable. Criminals can exploit these stolen accounts to carry out additional fraud.

Zscaler researchers advice is:

To avoid becoming a victim of such malware, it is a good practice to download apps only from trusted app stores such as Google Play. This practice can be enforced by unchecking the “Unknown Sources” option under the “Security” settings of your device.

We may add to turn on “App Verification”. Verify Apps regularly checks activity on your device and prevents or warns you about potential harm. Verify Apps is on by default, as is Unknown Sources turned off. Verify Apps also checks apps when you install them from sources other than Google Play. Of course, there is a privacy trade-off. Some information has to be sent about the apps you install back to Google.

The main advice is: use common sense. It’s common practice for companies to release official apps versions through Google Play and highly unlikely to do it via any other way.

Open Sound Control Of Kitchen Lights

Controlling the Internet of Things is all about passing information around. Realistically, it doesn’t matter what is used, be it MQTT, HTTP, serial data, whatever, and it doesn’t really matter what data is sent as long as the sender and receiver agree on what the data means. MIDI could be used to pass information back and forth, for example and while MIDI is good for some things, Open Sound Control is a more modern alternative and one area where OSC excels over MIDI is Internet connectivity. [Matt] used OSC to control the lighting he installed in his kitchen.

kitchen_controller
ESP8622-1 and Buck Converter

[Matt] had moved in to a new house and wanted some under-cupboard lighting for his kitchen. He got a few cheap warm white LED lights from the Internet and went about wiring them together. For the controller, an ESP8266-1 was used as well as a 12 volt constant-current buck converter. The software runs on the Sming framework, rather than the Arduino framework, and listens for incoming OSC messages. When it receives a command on a specific channel, a callback function turns the lights on and off.  [Matt] also added a switch on the outside of the control box to manually turn the lights on and off.

OSC might not be the right choice for this project, and even [Matt] doesn’t know why he used it, but [Matt] got it working and uses an app on his phone to control it. If he wanted to, he could have used Ableton or another controller to control the lights. (He hasn’t wanted to yet.) OSC is an interesting alternative to MIDI and can also be used with an Arduino without an ethernet shield, or with RFID tags.