Syndicate content Hackaday
Fresh hacks every day
ถูกปรับปรุง 4 hours 18 min ก่อน

Think Your Way to Work in a Mind-Controlled Tesla

ศุกร์, 11/18/2016 - 19:01

When you own an $80,000 car, a normal person might be inclined to never take it out of the garage. But normal often isn’t what we do around here, so seeing a Tesla S driven by mind control is only slightly shocking.

[Casey_S] appears to be the owner of the Tesla S in question, but if he’s not he’ll have some ‘splaining to do. He took the gigantic battery and computer in a car-shaped case luxury car to a hackathon in Berkley last week and promptly fitted it with the gear needed to drive the car remotely. Yes, the Model S has steering motors built in, but Tesla hasn’t been forthcoming with an API to access such functions. So [Casey_S] and his team had to cobble together a steering servo from a windshield wiper motor and a potentiometer mounted to a frame made of 2x4s. Linear actuators attach to the brake and accelerator pedals, and everything talks to an Arduino.

The really interesting part is that the whole thing is controlled by an electroencephalography helmet and a machine learning algorithm that detects when the driver thinks “forward” or “turn right.” It translates those thoughts to variables that drive the actuators. Unfortunately, space constraints kept [Casey_S] from really putting the rig through its paces, but the video after the break shows that the system worked well enough to move the car forward and steer a little.

There haven’t been too many thought-controlled cars featured here before, but we have covered a wheelchair with an EEG interface.

Filed under: car hacks

iPhone NVMe Chip Reversed with Custom Breakout Boards

ศุกร์, 11/18/2016 - 16:01

Ever so slowly, the main storage in our computers has been moving from spinning disks, to SSDs over SATA, to Flash drives connected to a PCI something or other. The lastest technology is NVMe — Non-Volitile Memory Express — a horribly named technology that puts a memory controller right on the chip. Intel has a PCI-based NVMe drive out, Samsung recently released an M.2 NVMe drive, and the iPhone 6S and 6S Plus are built around this storage technology.

New chips demand a reverse engineering session, and that’s exactly what [Ramtin Amin] did. He took a few of these chips out of an iPhone, created a board that will read them, and managed to analize the firmware.

Any reverse engineering will begin with desoldering the chip. This is easy enough, with the real trick being getting it working again outside whatever system it was removed from. For this, [Ramtin] built his own PCIe card with a ZIF socket. This socket was custom-made, but the good news is you can buy one from ITEAD. Yes, it is expensive — that’s what you get with a custom-made ZIF socket.

With the chip extracted, a custom PCIe card, and a bit of work with the NVMe implementation for Linux, [Ramtin] had just about everything working. Eventually, he was able to dump the entire file system on the chip, allowing anyone to theoretically back up the data on their iPhone or MacBook Air. Of course, and especially for the iPhone, this data is encrypted. It’s not possible to clone an iPhone using this method, but it is a remarkably deep dive into the hardware that makes our storage tick.”

Filed under: hardware

Vintage Tube Radio Restorations

ศุกร์, 11/18/2016 - 13:00

[J.B. Langston] has some vintage late-40’s/early-50’s tube radios that he wanted to repair – a Motorola All-American 5 AM radio, an Air Castle AM/FM radio and a Sears Silvertone AM/FM radio. He goes over, one by one, the three vintage radios, the problems they had, and how he got them back into working order. No finding a replacement microchip here, this was all about replacing capacitors and finding vacuum tubes!

In contrast to most modern builds we see on Hackaday, vintage radios are fairly simple – mainly turret-board builds with a transformer, resistors, capacitors, coil and tubes. The main issues in any vintage electronic repair is checking the capacitors because old wax paper and electrolytic capacitors can degrade and will need replacing. When repairing the All-American 5, [J.B. Langston] had an issue with the transformer, and he goes over how he fixed what’s called silver mica disease in it. While many parts were replaced with modern equivalents, only a selenium solid-state rectifier in one of them was replaced by a different part – a silicon diode and a high-wattage series resistor.

Looking at the inside of some of these radios, it’s surprising that they could be restored at all – 65-odd years of rust, dust, dirt and grime will take their toll – but [J.B. Langston] was able to fix all three radios and clean their Bakelite cases so they look and work like new. He goes over what he discovered, how he fixed the problems and the links to where he got help when needed. We’ve seen some great vintage radio projects over the years, including adding RDS (Radio Data Systems) to a vintage radio, converting a vintage radio with modern technology and even some other radio restoration projects.

Filed under: radio hacks

A DIY Vacuum Pickup Tool for $75

ศุกร์, 11/18/2016 - 10:00

If you’re assembling prototypes of SMD boards on your own, placing the parts accurately can be a pain. Of course, it’d be nice to have a full pick and place machine, but those are rather expensive and time consuming to set up, especially for a small run of boards. Instead, a vacuum pickup tool can help you place the parts quickly and accurately by hand.

The folks over at Ohmnilabs have put together their own DIY pickup tool for about $75, and it’s become part of their in-house prototyping process. They grew tired of placing components with tweezers, which require you to remove parts from the tape before lifting them, and have a tendency to flip parts over at the worst time.

The build consists of a couple parts that can be bought from Amazon. An electric vacuum pump does the sucking, and the vacuum level is regulated with an adjustable buck converter. A solid foot switch keeps your hands free, and syringe tips are used to pick the parts up.

This looks like a simple afternoon build, but if you’re prototyping, it could save you tons of time. To see it in action, check out the video after the break.

Filed under: tool hacks

A Laser Effect Projector Built with Safety in Mind

ศุกร์, 11/18/2016 - 07:00

There’s just something about wielding a laser pointer on a dark, foggy night. Watching the beam cut through the mist is fun – makes you feel a little Jedi-esque. If you can’t get enough of lasers and mist, you might want to check out this DIY “laser sky” effect projector.

The laser sky effect will probably remind you of other sci-fi movies – think of the “egg scene” from Alien. The effect is achieved by sweeping a laser beam in a plane through swirling smoke or mist. The laser highlights a cross section of the otherwise hidden air currents and makes for some trippy displays. The working principle of [Chris Guichet]’s projector is simplicity itself – an octagonal mirror spun by an old brushless fan motor and a laser pointer. But after a quick proof of concept build, he added the extras that took this from prototype to product. The little laser pointer was replaced with a 200mW laser module, the hexagonal mirror mount and case were 3D printed, and the mirrors were painstakingly aligned so the laser sweeps out a plane. An Arduino was added to control the motor and provide safety interlocks to make sure the laser fires only when the mirror is up to speed. The effect of the deep ruby red laser cutting through smoke is mesmerizing.

If laser sky is a little too one-dimensional for you, expand into two dimensions with this vector laser projector, and if monochrome isn’t your thing try an RGB vector projector.

Filed under: Arduino Hacks, laser hacks

Open Microfluidics Instrumentation Playset

ศุกร์, 11/18/2016 - 04:01

Micro-what? Microfluidics! It’s the field of dealing with tiny, tiny bits of fluids, and there are some very interesting applications in engineering, biology, and chemistry. [Martin Fischlechner], [Jonathan West], and [Klaus-Peter Zauner] are academic scientists who were working on microfluidics and made their own apparatus, initially because money was tight. Now they’ve stuck to the DIY approach because they can get custom machinery that simply doesn’t exist.

In addition to their collaboration, and to spread the ideas to other labs, they formed DropletKitchen to help advance the state of the art. And you, budding DIY biohacker, can reap the rewards.

In particular, the group is focused on droplet microfluidics. Keeping a biological or chemical reaction confined to its own tiny droplet is like running it inside its own test-tube, but because of the high rate at which the droplets can be pumped out, literally millions of these test-tubes are available. Want to grow hundreds of thousands of single cells, each in their own environment? Done.

The DropletKitchen kit includes an accurate pump system, along with high-speed camera and flash setups to verify that everything’s working as it should. Everything is open-source, and a lot of it is 3D-printable and written in OpenSCAD so that it’s even easy to modify to fit your exact needs. You just need to bring the science.

This is a professional-grade open source project, and we’re excited to see it when academics take a turn toward the open. Bringing cutting edge processing technologies within reach of the biohacker community is a huge multiplier. We can’t wait to see what comes out of this.

Filed under: chemistry hacks

Enlightened Raspberry Pi Contest Winners

ศุกร์, 11/18/2016 - 03:05

The Enlightened Raspberry Pi Contest wrapped up last week. As soon as the contest closed, Hackaday’s crack team of judges jumped on the case. Every entrant was carefully reviewed.  This was no easy feat! The field of 168 projects included both new concepts and old favorites. All of them were designed, built and documented with care. After all the votes were counted, 8 finalists rose to the top and were sent to [Matt Richadrson], [Ken Shirriff], and [Alvaro Prieto], our VIP judges, for the final ranking.

Each and every project creator deserves recognition for not only building an awesome project, but documenting it on Hackaday.io so others can build, modify, and enjoy their own versions. Without further ado, here are the winners of the Enlightened Raspberry Pi Contest!

Grand Prize

Grand Prize goes to [nick.r.brewer] with PIX-E Gif Camera. [Nick] has created a camera which can shoot animated GIF files, a mainstay of the internet since the 90’s. The camera’s 3D printed case takes us back to the days of disposable 35mm shooters. Alvaro said “Love the combination of written instructions with photos and time-lapse videos of the assembly process. If I were to try to put this together, I know I’d have everything I need to know available on the site.”
[Nick] will be taking home a Pi-Top Raspberry Pi powered Laptop.


First Prize

First prize goes to [Ben Pirt] and [Ben Gray], collectively known as Mime industries, for MeArm Raspberry Pi Edition. [Ben and Ben] improved upon the well-known MeArm. They simplified the design, reducing the screw count from 40 to 12. More importantly they added a Raspbery Pi and a joystick controller hat. Ken had this to say:

“This robot arm project is very polished, consisting of both the mechanical design and software. The step-by-step construction instructions are clear and easy to follow. The mechanical design is well though out, with pieces that snap together nicely.”

[The Bens] have won a Pi-Top Ceed all in one Pi Powered computer for the Mime industries offices.

Second Prize

Second prize goes to [Solenoid] with Bypassing TV broadcasting restrictions. [Solenoid’s] father can’t watch many of his favorite television channels due to geographical restrictions in their native Switzerland. [Solenoid] has created a device which receives RF broadcasts, then retransmits them over the internet. Matt said:

“This project thoroughly explained the software setup, something that is often rushed through in other projects.”

[Solenoid] wins an Adafruit 32×32 RGB Matrix Setup. We’re hoping he uses it as a low-res (1024 pixel!) TV viewer to go along with his project.

The Remaining Finalists:

We’re happy to award five more prizes to round out the top eight entries.

Runner up [davedarko] with Portable Raspberry PI Zero wins a Raspberry Pi Camera V2


We’d like to congratulate all the winners, as well as thank everyone who entered the contest. The fun doesn’t end here though. The Enlightened Raspberry Pi Contest was the first of a series of contests here at Hackaday. We’re already teasing the next contest, The 1kB Challenge. Look for an official launch post on Monday!

Filed under: contests, news

Grace Hopper, Margaret Hamilton, Richard Garwin Named for Medal of Freedom

ศุกร์, 11/18/2016 - 02:05

Somewhat hidden among athletes, actors, and musicians, three giants of technology have been aptly named as 2016 Presidential Medal of Freedom recipients. Grace Hopper, Margaret Hamilton, and Richard Garwin all made significant contributions to the technology that envelops our lives and embody the quest for knowledge and life-long self learning that we’d like to see in everyone.

Rear Admiral Grace Hopper’s legacy lies with the origins of computer science. She wrote the first compiler. In a time when computers were seen more as calculating machines than easily adaptable frameworks she looked to the future and made it happen. She continued to make huge contributions with lasting effect in developing COBOL, unit testing methods for programmers, and in education. We have long loved her explanation of a nanosecond (and why software engineers shouldn’t waste cycles) and was one of the first to program on the Harvard Mark I which can still be seen in the lobby of the school’s engineering building.

As Director of Apollo Flight Computer Programming, Margaret Hamilton is the driving force behind the software of Apollo. When the program started, she was Director of Software Engineering at MIT Instrumentation Laboratory. Originally there wasn’t a plan or budget for software in the space program. Hamilton built the program and led the team who wrote the software and turned it into punch cards to be fed into the computer. We enjoyed reading about some of her adventures during the Apollo project, her drive to develop pristine code is palpable. Over the past year we’ve marveled at the rope memory of the Apollo Guidance Computer and delighted when a hardcopy of AGC software showed up at a party. Her legacy at having written the code for the first portable computer — one that happened to land on the moon and return home safely — is incredible.

Physicist Richard Garwin’s name is most associated with the first hydrogen bomb design. But another part of his work is more likely to have directly touched your life: his research into spin-echo magnetic resonance helped lead to the development of Magnetic Resonance Imaging. MRIs have of course become a fundamental tool in medicine. Garwin studied under Fermi during his doctoral work — you may remember Fermi from our look at the Fermiac analog computer last year.

Congratulations to these three recipients, their recognition is incredibly well deserved. We’d love to hear about some of your own technology heroes. Let us know on the tips line so that we may help celebrate their accomplishment and inspire the next generation of giants.

Image Credits:
Filed under: History, news

Creating A PCB In Everything: KiCad, Part 1

ศุกร์, 11/18/2016 - 01:01

This is the continuation of a series of articles demonstrating how to Create A PCB In Everything. In this series, we take a standard reference circuit and PCB layout — a simple ATtiny85 board — and build it with different PCB design tools. Already, we’ve taken a look at the pre-history of PCB design with Protel Autotrax, we learned Fritzing is a joke for PCB design, and we’ve done a deep dive into Eagle. Each of these tutorials serves two purposes. First, it is a very quick introduction to each PCB design tool. Second, this series provides an overall comparison between different PCB design tools.

Now, finally, and after many complaints, it’s time for the tutorial everyone has been waiting for. It’s time for KiCad.

No, like the head of the Bajoran clergy

Although KiCad (pronounced ‘Kai-Cad’ like the head of the Bajoran clergy, not ‘Key-Cad’ like the thing that goes in a lock) is the new hotness when it comes to PCB design. The amazing growth of KiCad installations over the past few years is a long time coming. In development since 1992, KiCad has cemented itself as the premier Open Source PCB design suite, and since 2013 CERN has been making contributions to the project. More recently, the KiCad project has been showing off some amazing new features. These include 3D rendering of boards, interactive routing, push-and-shove, simulation, and dozens of other features that put it on a path to being on par with the top of the line EDA suites. Add in some great community contributions, and you have something really, really amazing. All of this is wrapped up in an Open Source license, free as in speech and beer. If you’re looking for the future of PCB design, Eagle is going to get very good but KiCad is almost there now while being Open Source.

The KiCad Overview

As I said in the introduction to this series of posts, this tutorial will be broken down into three main parts. The first will be how to create a part — specifically a DIP8 ATtiny85 — as a schematic symbol and how to create the schematic we need. The second part of this KiCad tutorial will assign footprints to our symbols and turn the schematic into a board you can send off to a fab house. Finally, we’ll take a look at the cool features of KiCad, such as push and shove routing and 3D rendering.

For this part of the KiCad tutorial, we will only concern ourselves with making a part for a DIP8 ATtiny85. Download KiCad and let’s get started.

Your first view of KiCad

Just like Eagle – and every other PCB design tool, for that matter – there are several different editors in KiCad. They are:

Eeschema – the schematic editor


The Schematic library editor – used for editing part libraries


Pcbnew – the ‘board’ editor


The PCB footprint editor – used for editing footprints (the physical package) of parts


An introduction to the terminology of PCB design might be in order. A schematic is the abstract design file, showing the electrical connections between all the components in your circuit. The schematic is not sent to the fab house.

PCB or board describes the layout of the components, holes, pads, traces, connections, mechanical design, and silkscreen. Designing a board is the end game of all PCB design work, and it is this file that gets sent off to a fab house for manufacturing.

Before we put together a schematic and design a board, we must learn how to build our own parts. To start, install KiCad, select File -> New Project, and name it ‘Nanite’, or ‘Some Trash I’ll Never Do’

Making A Part

All of these tutorials demand making a part from scratch. Right now, that means making a part and footprint for a DIP8 ATtiny85. From the main KiCad window, open up the Part Library Editor, and you have a window that looks like this:

When you first open the Part Library Editor, no libraries are loaded. You would think it would be possible to simply create a new library, and design some parts, but KiCad is weird. To make your own library in KiCad, you must first select an existing library and save it as your own. Yes, it’s a bit weird and one of the many oddities of the KiCad UX, but at least it’s better than Fritzing.

Save this library you just ‘created’, select File -> Current Library, and select the library you just saved. Now we can begin to make a part.

Click the ‘Create a new component’ opamp icon, and you’re presented with a window asking you to name your part. For small, simple, jellybean components, you won’t have to bother with anything except for the name. Name your part ATtiny85 and click okay. The name and designator of the part will be dropped into the window. Now we’re ready to add pins to our part.


Oh God Everything Is Backwards And My Mouse Doesn’t Do Anything


If you’re following along with this tutorial, this is the first time you’ll actually use the KiCad interface. KiCad has a reputation for being incomprehensible for the beginner. Want some proof of that? Click on the ‘ATtiny85’ label and try to move it. You would think just clicking it would do something, but that only opens up some options (bold, italic, size, justification) for the text. If the ‘ATtiny85’ and ‘U?’ overlap, clicking on both of them opens up a dialog box.

There’s a reason for this: KiCad, like almost every other PCB design tool, is based on hotkeys. This is the reason KiCad gets the reputation for not being user-friendly, but there’s a solution: just type a question mark. The list of hotkeys will pop up, and now you’ll always know what keys you need to hit to do what you want to do. To move the ‘ATtiny85’ and ‘U?’ label off to the side, hit ‘M’ while hovering the mouse over each label.

Now it’s time to add pins. Click the ‘Add pins to Component’ button on the right side of the window. Next, click anywhere on the Part Library Editor window.

The Pin Properties window is where you assign a name, number, and graphical style to all of the pins in the schematic representation of your part. We’re doing a very simple part with power and ground on one side, and all the IO on the other side. As long as the pin names are correct, and all the pins correspond to the correct numbers on the footprint, you shouldn’t have much trouble. The only thing that might trip you up is the orientation of the pins; here, the circle at the end of each pin designates where the pin connects to a net on the schematic.

Drop eight pins down and make your part look something like what we made in the Eagle tutorial. You’ll end up with something like this:


With the pins dropped into the window and correctly labeled, all we need to do to finish the part is to draw a rectangle. Click on the ‘draw a rectangle’ icon, click once in the corner, drag, and click again to finish the rectangle. Hit File -> Save Current Library, and we’re done making the schematic symbol for this part.

From Symbol To Schematic

Now that we have a symbol for the ATtiny85 we’re going to use in this board, it’s time to make a schematic. From the main KiCad window, open up the Electronic Schematic Editor, and you’ll be presented with the following window:

Again, the hotkeys are going to kill you. To add a component, press ‘A’. You might also want to hit ‘?’ and bring up the list of hotkeys.

At this stage, we’re not concerned with footprints, or the physical dimensions of the components we’re eventually going to place on the board. All we want are symbols. There are hundreds of different varieties of USB connectors, but right now we don’t care. All we need to do is drop a few resistors, diodes, connectors, and other parts onto the schematic. To do that, press ‘A’, and the window below will pop up.


Since we’re directly copying the reference schematic from the introduction to this series, we need the following components:

  • Two 1×4 connectors
  • Two Zener diodes
  • Four resistors
  • One LED
  • One USB port (OTG)
  • One unpolarized cap
  • One ATtiny85
  • A smattering of +5V and GND symbols

For each of those components, press ‘A’ to add a part, search for the part, and drop it onto the schematic. If you’re really good, you can use the ‘P’ hotkey to add power and ground parts. When you’re done, you should have something that looks like this:

That looks about right

The important hotkeys to know are ‘A’ to add a part, ‘M’ to move a part, and now ‘W’ to add a wire between parts. Again, pressing ‘?’ displays a list of hotkeys. Of special interest is the ‘K’ hotkey to stop drawing a wire.

With all the wires drawn, it’s time to label these wires to connect them into ‘nets’ Check out the reference schematic to the right. The wires coming off the USB/Zener/resistor chunk of the schematic are labeled ‘PB4’ and ‘PB3’. These are nets connected to the PB4 and PB3 pins on the ATtiny, and are used for USB communications. The 1×4 headers are connected directly to every pin on the ATtiny, so we label them accordingly.

To label these wires and turn them into nets, use the ‘L’ hotkey, and select a name for each of your nets. Drop this label over the open connection on each wire to turn them into nets. When you’re done, you’ll have something that looks like this:

We’re almost done with the schematic. All we need to do now is add values to the relevant parts. The resistors must be labeled with the right value, the capacitor should 22nF or thereabouts, and the Zeners should have a ‘3.6’ label. It’s time for hotkeys again, this time brought to you by the letter ‘V’. Press ‘V’ over all the caps, resistors, diodes, and the LED and assign values. This takes care of the values for each part, but we still need to give each part a name. To do this, we’re going to use the ‘Annotate Schematic’ tool available in the top toolbar.

The Annotate Schematic tool automatically assigns a letter (D for diodes, L for inductors, R for resistors, Q for transistors…) to each part, along with a number. There are options to set how these numbers are assigned, but this is a very simple circuit and simply pressing the ‘annotate’ will suffice.

With that, our schematic is done. We haven’t set any footprints up for each part, and we haven’t even started on the board yet. This post is already two thousand words long, though, and Hackaday readers have the entire Internet has no attention span.

In the next part of this KiCad tutorial, we’re going to take a look at assigning footprints (the physical representation of components) to the parts in our schematic. We’re going to make a board, after which we’ll take a look at DRC, and a few of the neat tricks in KiCad including 3D rendering, turning the board into a bunch of Gerbers, and send off to a fab house.

Filed under: Hackaday Columns, how-to, Skills

Raspberry Pi Robot That Reads Your Emotions

พฤ, 11/17/2016 - 23:31

It’s getting easier and easier to add machine intelligence to your hacks, even to the point where you sometimes don’t have to install any special software. In this case [Dexter Industries] has added the ability to read human emotions to their EmpathyBot robot by making use of Google Cloud Vision.

Press a button on the robot and it moves forward until it’s a certain distance from an object. It then takes a picture and sends it off to Google Cloud Vision along with a request to do face detection. The response that Google returns is in JSON format and, if it finds a face, includes the likelihood of the face being happy, sad, sorrowful or surprised. The robot parses that response and gives an appropriate canned speech using the text-to-speech software, eSpeak e.g. “You seem happy! Tell me why you are so happy!”.

[Dexter] has made the source code available on github. It’s written in python and is easy to read by anyone with even just a little programming experience. The video after the break gives a number of demonstrations, including some with non-human subjects.

On their webpage, [Dexter Industries] also gives a little further analysis. For example, one subject had facial hair which gave Google difficulty with interpreting the emotion. But after some trimming, interpretation improved. It did have difficulty with a baby though, possibly due to chubby cheeks.

We recently saw other examples of hacks using machine intelligence software. [Dexter] has used Google Cloud Vision before for sorting candy. And before that it was Google’s Tensorflow being used by a robot to recognize and say the names of objects around a garage.

Filed under: robots hacks

Smartphone Bench Instrument Apps: Disappointment or Delight?

พฤ, 11/17/2016 - 22:01

If you are interested in electronics or engineering, you’ll have noticed a host of useful-sounding apps to help you in your design and build work. There are calculators, design aids, and somewhat intriguingly, apps that claim to offer an entire instrument on your phone. A few of them are produced to support external third-party USB instrument peripherals, but most of them claim to offer the functionality using just the hardware within the phone. Why buy an expensive oscilloscope, spectrum analyzer, or signal generator, when you can simply download one for free?

Those who celebrate Christmas somewhere with a British tradition are familiar with Christmas crackers and the oft-disappointing novelties they contain. Non-Brits are no doubt lost at this point… the crackers in question are a cardboard tube wrapped in shiny paper drawn tight over each end of it. The idea is that two people pull on the ends of the paper, and when it comes apart out drops a toy or novelty. It’s something like the prize in a Cracker Jack Box.

Engineering-oriented apps follow this cycle of hope and disappointment. But there are occasional exceptions. Let’s tour some of the good and the bad together, shall we?

The Weaknesses There is a lot of test equipment you can download, but are they any good?

Of course, it’s not that simple. Modern phones have plenty of processing power, but when it comes to analogue input and output they are restricted to only the hardware they need to make a telephone call. A single microphone input, and a stereo output that can drive a line input on an amplifier, or a set of headphones. Unless you have spent a lot of money on a very high-end phone targeted at audiophiles these will not be served by particularly high-end silicon, the ADC and DAC will top out at somewhere just above the CD sample rate of 44.1kHz and will not have the quietest noise performance. They will not be in any way calibrated, so the best you can hope for from your hardware in terms of measuring ability will be a bandwidth of somewhere just above 20KHz with no ability to produce or measure quantifiable voltages. To give some context, even a 5-dollar USB sound card for your PC will be capable of a higher bandwidth than that you’ll find in your phone.

Our question posed earlier in this piece then becomes “Why buy an expensive oscilloscope, spectrum analyzer, or signal generator, when you can simply download one for free that only has a 20KHz bandwidth and can’t accurately measure or produce a known voltage?” It doesn’t sound very encouraging, does it.

But looking at it another way, you can’t argue with free. If you are working at audio frequencies then perhaps they can offer something useful. Even with their limitations perhaps there are still areas in which they can deliver useful insights, and that’s what we’ll now investigate.

The Strengths

We’ve looked at the shortcomings of a mobile phone as an instrument platform, but does it have any strengths? In one respect here we are fortunate. A phone may not be able to measure voltages accurately, but it should be able to do so when it comes to frequencies and timing. All the actions of its microprocessor will be governed by a crystal oscillator, which while it won’t be calibrated to an incredible standard will still be good enough for the purposes of a free mobile phone instrument.

Even if we can’t entirely trust our phones on matters of amplitude we can do so in this field, if it returns a frequency or period reading we can believe it. Another area in which we can place some trust in our phones lies with waveform generation. Within the limitations of its DAC we know that it is designed to reproduce whatever waveforms a piece of music can supply it, so for the purposes of a very simple audio benchtop instrument we can trust it to produce the sine, square, and triangle waves we’d expect from a basic signal generator.

Having considered the likely usefulness of a mobile phone app instrument and thus having an idea of what to expect, it’s time to sit down at the bench with a phone and try a few for real. This isn’t a review of the apps themselves but a look at the feasibility of an app as an instrument, so we’ll mention a few apps but not review their individual features in detail. Our device for these tests is a Moto G4 running Android 6.0.1.

Signal Generators The Keuwlsoft function generator.

We started by looking at the performance of a phone as a signal generator. There are a lot of results for a search on “signal generator” or “function generator”, one of the ones near the top was keuwlsoft’s offering, capable of producing sine, triangle, and square waves from 22kHz down to an improbable-sounding 471.16mHz, as well as a selection of noise sources and modulation effects.

Installed on the phone, it rewarded us with a tone in the speaker after the usual moment to decipher its UI. Plugging in a 3.5mm jack with a lead to our ‘scope, and we could see the three types of waveform as expected. The frequency was measured as exactly the figure in the app. At the upper end of the frequency range above 20KHz it became obvious that the waveform was diminishing and distorting, however that is probably a feature of the Moto’s audio hardware. Otherwise the amplitude stayed pretty constant over the audio range.

On the subject of amplitude, these apps are usually calibrated in percentage of the maximum amplitude they can serve, there is no voltage reading. However to give an idea of the output level, with both the in-app gain and the device volume set to maximum we measured 945mV RMS for a 1KHz sinewave. Knowing that figure it was a simple matter of setting the in-app gain to a calculated percentage to give a lower figure, for example to achieve a 500mV RMS reading we set it to 52.91%. It’s not perfect by any means, but if you have measured the output at full volume it is possible to impose some level of calibration.

Having exercised the phone’s capabilities producing waveforms, it’s time to consider its abilities measuring them. There are a variety of apps freely downloadable that offer either oscilloscope, spectrum analyzer, or a combination of both functionalities.

Input Problems If you’re very lucky, your app might have an input selection screen.

The first thing we encountered when installing these apps was the nature of Android’s approach to audio hardware. By default these apps take their input from the microphone. Everyone who installs them probably spends a while whistling at their phone to see a nice waveform or spectrum peak appear, but sadly for our purposes a microphone is no use. We need a physical input, and you might think that could be served by the microphone input on the device’s 3.5mm jack plug. Unfortunately a modern phone is not the same as a cassette recorder of old, so we quickly discovered that simply plugging in the appropriate TRRS lead did not magically switch over from the microphone.

Instead that changeover is handled by software, and whether it works for you will depend on how lucky you are in your combination of phone, OS version, and app. We did not find any apps that recognized an audio source plugged into the jack socket by default on the Moto, though a couple of spectrum analyzer apps offered a source selection option in their settings between the built-in microphone, and the line input.

A cheap USB sound card as an Android audio input.

Happily there is an alternative that shouldn’t cost too much if your phone is a fairly recent one. Since version 5 there has been support in Android for USB sound cards, so if you have an OTG cable you can plug one in and reboot the phone to find its default audio input and output now come through the sound card. To test the oscilloscope apps we did this with the Moto and a cheap no-brand USB audio dongle, and it performed very reliably. It’s important to reboot the phone with it plugged in, we found it wasn’t always recognized when plugged in after reboot. It’s also worth noting that even though our USB card is capable of more than CD-quality sample rates there was no provision to enable these in any of the software.

Whichever way you get your working input to your phone, there is one further thing to beware of. A mobile phone input is designed only for use with a headset microphone for making calls, thus it expects a microphone level signal. It will top out somewhere well under 100mV, and anything above that (such as line level audio) will push it into distortion. Further, it does not have anything like the resilience of a real ‘scope input so unless you are only measuring up to about 50mV you will have to build some form of protection circuitry. Have a look at this preamplifier project for an example. For the purposes of our tests when using the Moto’s input jack we wound down our signal generator to an appropriate level for the input.

Spectrum Analyzers The Vuche Labs spectrum analyzer when fed with a 1kHz square wave.

Having now dealt with the prerequisites of getting a signal into our phone, it’s time to look at some apps to use it. Starting with a spectrum analyzer, we found that Vuche labs’ Advanced Spectrum Analyzer offered the ability to select the Moto’s 3.5mm jack as an input, and presented an interface that was easy to get working. When presented with a sine wave it obligingly produced a single peak, and on changing to a square wave it showed the harmonic content as you might expect. It consistently identified the fundamental frequency on the low side by a few Hz, for example showing a verified 1KHz as 990Hz.

On the Y axis it returns a figure in dB. As always the question is “dB relative to what?”, and the answer here appears to be relative to the maximum level quantifiable by the device. So if you have time to calibrate it against a known instrument as described above and do some calculations you could get some idea of  a real figure, however in the majority of cases this scale can at best be considered as indicative only for relative quantization of peaks.


When looking at oscilloscope apps we tried almost every one that the Google Play Store could find for us, and none of them offered an ability to select the Moto’s 3.5mm jack that would work. It’s not to say that none of them support it on other phone and OS combinations, merely that none of them worked for us. So when testing these apps we had to resort to the USB sound card mentioned above, a mild inconvenience but one that a subset of the apps had no problems recognizing.

LabNation’s SmartScope showing a 1kHz sine wave.

SmartScope Oscilloscope from LabNation is a companion app to their oscilloscope peripheral which gives the features you’d expect from a “proper” ‘scope, but it also has a mode that supports the phone’s audio input. We liked it because unlike many other ‘scope apps it has a user interface allowing easy pinch-and-zoom selection of timebase period and voltage. In the time domain it’s extremely easy to measure period with this app, but the amplitude domain like those on the other apps can not be trusted when not using their peripheral and would need calibration against a known instrument. It does however handle different waveforms as you’d expect from a conventional oscilloscope, and provides a handy way to look at the shape of an audio waveform.

Cracker Or Bench? Our Conclusions

So after several hours at the bench installing and trying test equipment apps, what do we think? The overwhelming impression is that none of these apps could replace the real instrument on their own using just the phone’s hardware. It’s quite possible that with a dedicated peripheral they could provide a good instrument, but that is beyond this article.

That said, do these apps offer any useful functionality, and is it worth keeping them on your phone? We’d say yes in that a not very good instrument is better than no instrument, but we’d like to qualify that by looking at each case individually.

Signal generators, at least in the audio range, are something at which the apps do a passable job. If your voltage requirements extend only to audio line level and below, and you have no wish to venture above 20kHz, they make a useful audio source that is capable of delivering a variety of combinations of waveform. Definitely useful.

Spectrum analyzers though are not a field in which the phone performs as well as signal generation. These apps are fine in the frequency domain so as long as you stay within the voltage range of the input you can use them to gain a view of what frequencies are present, however the lack of intensity calibration is an Achilies’ heel. It’s probably best to consider these as half-useful, half-novelty.

Oscilloscope apps are sadly closer to the Christmas cracker. Yes, you can see the shape and period of the waveform, but there is only a certain amount of information to be gleaned from these readings. The most useful feature of an oscilloscope as we see it is as an accurate time-domain voltmeter, and without that ability the app becomes significantly less useful. Three-quarters-novelty, quarter-useful.

Could these apps be improved? Definitely if their developers took the time to incorporate input selection to ensure that all users could force them to listen to the microphone jack. Unfortunately the feature that would be most useful, calibration in the voltage domain, is probably beyond the capabilities of a phone’s hardware without buying extra peripherals, which rather defeats the object.

After all, the one thing these apps have going for them is that they cost nothing, and that’s more than you can say for a Christmas cracker. Do you have suggestions for useful instrument apps? Let us know in the comments below.

Filed under: Featured, Interest, Original Art, tool hacks

Slow 3.5″ Raspberry Pi LCD Hacked to 40 MHz with ESP8266

พฤ, 11/17/2016 - 19:01

As microcontrollers become more and more common, we see more ways to get a lot of performance out of one chip. A great example of this was the ESP8266 which was originally seen as a cheap WiFi card but has since blossomed into its own dev platform thanks to the horsepower hidden within. To that end, [Martin] is trying to push the now-ubiquitous WiFi chip even further by rolling out his own LCD driver for it from scratch.

The display of choice is the KeDei LCD 3.5″ module which was originally intended for use with a Raspberry Pi. [Martin] points out that this display isn’t optimized for speed, but after everything is said and done he has its clock line running at 40 MHz. To get this kind of speeds from the LCD, he depopulates the first shift register and adds his own fast-propagation circuit to establish a more-traditional serial addressing mode. With use of a WLCD driver that [Martin] also wrote, it is now relatively easy to draw on the screen very quickly with an ESP module. Check it out in the video below.

If you’re looking for your own tiny, cheap, fast display, this is one cool way to do it but we would suggest spinning a carrier board for both the ESP and the added circuitry. We’re looking forward to future projects which puts devices like these inside of really tiny magic mirrors, or uses them in other places where a small graphical display would be handy.

Thanks to [Hemal] for the tip!

Filed under: classic hacks, slider, wireless hacks

Bot Wars: A Collateral Gift of the Automation Revolution

พฤ, 11/17/2016 - 16:00

I received an email Wednesday morning from a company launching new features for a bot called Trim which will negotiate a lower cable bill for you. Give it your Comcast login info and it will launch a support-chat window and go to work negotiating rates on your behalf. This could be a lower monthly rate, or one-time credits for slow or intermittent service.

This chatbot is a glimpse into our cat-and-mouse future. If rate-reducing automation is widely adopted by customers, Comcast will have an incentive to spot these chatbots and act accordingly, and they’ll probably want to automate that. This leads quickly to a war of bots.

How many times has Hackaday predicted the future? The coming bot wars were hinted at in an article I wrote back in 2009 on the re-emergence of Tradewars 2002. This is a turn-based BBS game that I loved as a child. The second version added an automation layer — the game had become a challenge to write a better script than your opponent to play the game with maximum efficiency. Of course, it’s only a prediction if you realize it at the time. But this gamification of automation from seven years ago is about to jump into the mainstream.

You win if your automation outperforms your competitors; this is the founding idea of the automation age. There’s no event horizon to mark our slide into the new realm. But we know the financial markets have been playing this game for a long time now (think flash crash and algorithmic trading). Continuing the customer service call example, call centers have been using scripts for years. Automation stems from this, just cutting out the human; you may already be talking to a chatbot and not knowing it — a human takes over when the bot has already verified your account info and gets stumped. The real question is will you take up arms by building your own bots or using those available from startups like Trim? Maybe you already have? We’d love to hear about it in the comments below.

[Image Source: the main and thumbnail images are of course from the United Artists film War Games.]

Filed under: rants

Characterizing A Cheap 500MHz Counter Module

พฤ, 11/17/2016 - 13:00

An exciting development over the last few years has been the arrival of extremely cheap instrumentation modules easily bought online and usually shipped from China. Some of them have extremely impressive paper specifications for their price, and it was one of these that caught the eye of [Carol Milazzo, KP4MD]. A frequency counter for under $14 on your favourite online retailer, and with a claimed range of 500 MHz. That could be a useful instrument in its own right, and with a range that significantly exceeds the capabilities of much more expensive bench test equipment from not so long ago.

Just how good is it though, does it live up to the promise? [Carol] presents the measurements she took from the device, so you can see for yourselves. She took look at sensitivity, VSWR, and input impedance over a wide range, after first checking its calibration against a GPS-disciplined standard and making a fine adjustment with its on-board trimmer.

In sensitivity terms it’s a bit deaf, requiring 0.11 Vrms for a lock at 10 MHz. Meanwhile its input impedance decreases from 600 ohms at the bottom of its range to 80 ohms at 200 MHz, with a corresponding shift in VSWR. So it’s never going to match a high-end bench instrument from which you’d expect much more sensitivity and a more stable impedance, but for the price we’re sure that’s something you can all work around. Meanwhile it’s worth noting from the pictures she’s posted that the board has unpopulated space for an SPI interface header, which leaves the potential for it to be used as a logging instrument.

We think it’s worth having as much information as possible about components like this one, both in terms of knowing about new entrants to the market and in knowing their true performance. So if you were curious about those cheap frequency counter modules, now thanks to [Carol] you have some idea of what they can do.

While it’s convenient to buy a counter module like this one, of course there is nothing to stop you building your own. We’ve featured many over the years, this 100MHz one using a 74-series prescaler or this ATtiny offering for example, or how about this very accomplished one with an Android UI?

Filed under: tool hacks

Taig Mill Anointed with Ball Screws (at last!)

พฤ, 11/17/2016 - 10:00

Yup, we can hear a crowd full of “not-a-hack” loading their cannons as we speak, but this machine has a special place in the community. For years, the Taig milling machine has remained the go-to micro mill for the light-duty home machine shop. These machines tend to be adorned and hacked to higher standards, possibly because the community that owns these tools tends to enjoy machining for machining’s sake–or possibly because every single component of the mill is available as a replacement part online. For many, this machine has been a starting point to making chips at home. (In fact, Other Machine Co’s CTO, Mike Estee, began his adventure into machining with a Taig.)

For years, Taig has sold their machines with a leadscrew and a brass nut that could be tensioned to cut down the backlash. Backlash still remains an issue for the pickiest machinists, though; so, at long last, Taig has released a backlash-free ball-screw variant in two incarnations: an all-in-one machine pre-fitted with ballscrews and an upgrade kit for customers that already decorated their garage with the lead-screw model.

In the clip below [John] takes us on a tour of the challenges involved in cramming 3, 12-mm ballscrews into the original topology. As we’d expect, a few glorious chunks of metal have been carved away to make space for the slightly-larger ballnut. Despite the cuts, the build is tidy enough to fool us all into thinking that ballscrews landed in the original design from the start.

Confused why ballscrews are such a giant leap from leadscrews? Lend your eyes and ears a few moment to take in [Al]’s overview on the subject.

Filed under: cnc hacks

Spinning 3D POV Display: a High School Term Project

พฤ, 11/17/2016 - 07:00

If you are a fan of sci-fi shows you’ll be used to volumetric 3D displays as something that’s going to be really awesome at some distant point in the future. It’s been about forty years since a virtual 3D [Princess Leia] was projected to Star Wars fans from [R2D2]’s not-quite-a-belly-button, while in the real world it’s still a technology with some way to go. We’ve seen LED cubes, spinning arrays, and lasers projected onto spinning disks, but nothing yet to give us that Wow! signaling that the technology has truly arrived.

We are starting to see these displays move from the high-end research lab into the realm of hackers and makers though, and the project we have for you here is a fantastic example. [Balduin Dettling] has created a spinning LED display using multiple sticks of addressable LEDs mounted on a rotor, and driven by a Teensy 3.1. What makes this all the more remarkable is that he’s a secondary school student at a Gymnasium school in Germany (think British grammar school or American prep school).

There are 480 LEDs in his display, and he addresses them through TLC5927 shift registers. Synchronisation is provided by a Hall-effect sensor and magnet to detect the start of each rotation, and the Teensy adjusts its pixel rate based on that timing. He’s provided extremely comprehensive documentation with code and construction details in the GitHub repository, including a whitepaper in English worth digging into. He also posted the two videos we’ve given you below the break.

What were you building in High School? Did it involve circuit design, mechanical fabrication, firmware, and documentation? This is an impressive set of skills for such a young hacker, and the type of education we like to see available to those interested in a career in engineering.

We’ve shown you one or two volumetric 3D displays before, and it would be nice to think that this one might encourage some more to be created. To pique your interest, here’s one with a spinning helix, and another similar to the one here using LED sticks.

Filed under: led hacks

Solving Hackaday’s Crypto Challenge

พฤ, 11/17/2016 - 04:00

Although I’ve been to several DEF CONs over the past few years, I’ve never found time to devote to solving the badge. The legendary status of all the puzzles within are somewhat daunting to me. Likewise, I haven’t yet given DefCon DarkNet a try either — a real shame as the solder-your-own-badge nature of that challenge is right up my alley.

But finally, at the Hackaday SuperCon I finally got my feet wet with the crypto challenge created by [Voja Antonic]. He developed a secondary firmware which anyone could easily flash to their conference badge (it enumerates as a USB thumb drive so just copy it over). This turned it into a five-puzzle challenge meant to take two days to solve, and it worked perfectly.

If you were at the con and didn’t try it out, now’s the time (you won’t be the only one late to the game). But even if you weren’t there’s still fun to be had.

Thar’ be spoilers below. I won’t explicitly spill the answers, but I will be discussing how each puzzle is presented and the different methods people were using to finish the quest. Choose now if you want to continue or wait until you’ve solved the challenge on your own.

Solve it in 1 Hour: Cheat!

First off, the only rule was: be the first one to email screenshots of the solution to badge@hackaday.com. In my mind that means there is no cheating, only varying levels of cleverness to accomplish a goal.

The crypto firmware wasn’t shipped on the badge, but given out as a precompiled hex file (find it in the files section of the challenge project). Even better, [Voja] hand coded this in assembly so it lacks the gibberish you’d expect to find when decompiling binaries that have been run through a C compiler. Check out the videos below and then challenge yourself to make sense of the decompiled hex. Some find this type of thing fun, others might consider it torture.

You can find both the compiled hex and the assembly source code on the challenge project page. [Sprite_TM] and [ThunderSqueak] both pulled up their decompilers right away, bypassing all challenges and getting to the final screen in under one hour. Can you do as well?

The Actual Challenges:

The challenges [Voja] laid out include five different rounds. There were some hints given when [Brian Benchoff] gave the talk (seen above) that launched the contest. Some of them were worthwhile while others were literally a red herring. He then flung thumb drives into the audience that were the first instances of the compiled hex in the wild.


The first puzzle is based on the game Mastermind. If you didn’t recognize it immediately, it shouldn’t have taken long to associate it with [Benchoff’s] clue. The game centers around guessing a combination. After each guess, the badge will tell you how many correct values you have in the right place and how many correct values you have in the long place.

For me, what took a long time is figuring out how the game is played normally, and then establishing what the badge version is telling me. You get feedback on the right after each guess and it took me well over half an hour to figure out what’s what. That established, I tried to get really good at Mastermind really quickly. This is folly. You have six chances to get the combination correct — a really high bar. I suggest you take a more mathematical approach to winning.

Blink, Blink Blink, Bliiiiiiink

When faced with a cluster of four LEDs blinking in unison it’s easy to figure out there’s some type of data there.

Playing with the buttons reveals alphanumeric input is possible. Decode this flashing, enter the correct answer, and you’ll work your way through to get the passcode for this challenge.


This one took me the most time, even though I cheated. A few days before the conference [Voja] had shown me the win screen for this one and it was still pretty hard.

The board is set up with the word GO. When you play around with the keys you find that there are four pairs of collumns that can be moved up and down. Align them all just right and you’ve solved the puzzle.

I knew what I was looking for so I just kept trying. But my initial thoughts were to transcribe all of the columns and write a script to show me every possible iteration. I figured if you put 40 of these on a page at a time, the fantastic pattern-recognition of the human eye would make the right one jump out at you — looks like [John Park] went that route too. However, there are something like 50 rows in each column for a total of 6.25M combinations.

So it’s not brute-forceable… how would you solve this?

Little Boxes

This challenge presents you with a clever little spinning cursor. Play around with it and you find you can set or clear any box in a 4×4 grid. There are no other instructions or feedback. But flip the badge over and you’ll notice what’s printed on the back silkscreen is a set of icons built on a 4×4 grid.

I think everyone does the obvious thing at this point. Try to enter each of the icons. This does nothing, but I spoke with [whosawhatsis] because I knew he was already working on challenge 5. His hint to me was that it isn’t depend on order that you enter.

Next I began writing some Python code to work on logical operations based on the glyphs. [Voja] walked by and saw me doing this. When we talked I mentioned I was going to try logical operations on each row of symbols. He gave me a clue that you’ll want to use more than just one row in those tests.

With these two shoves in the right direction it didn’t take me long to pass this challenge.


The final screen! Well, getting to that screen is a trick in itself. SPOILER: the stock firmware that came with the badges has a ball-bearing gravity demo that uses the accelerometer. It also has a dice roll when you shake the badge violently. I never discovered this even though I had the badge on hand for months. And that’s why I never would have found the fifth screen which is exposed by shaking the badge if someone at SuperCon hadn’t told me about it.

When you do get there you are greeted with a question mark. Playing with the keys lets you enter text. Each challenge gave me a code and I wrote them down along the way. I tried entering them here but I had 12 letters and challenge 5 takes only 8 letters.

In speaking with [Krux] about this he suggested that it was probably a cipher and pointed me to the Cipher Tools of Rumkin.com. This was fantastic advice, not only did it allow me to learn about different ciphers, but has the tools for you to try them out. About 20 minutes of poking around and I had it!

Many succeeded at solving the challenge but were slow to claim the top spot. That honor went to [Jonathan Dahan]. We’ll share more about his victory when we cover the badge hacking later this week.

A New Challenge: Emulation

So, you don’t have a badge, but you still want to play? Here is a new type of challenge for you. You have the compiled binary, you also have the sourcecode (both found on the challenge project). Who will be the first to port the challenge so that you play it virtually, without need for hardware?

If it helps, I already have an emulator that takes arrow inputs and shows a graphical representation of the screen. But this uses the SDL2 library and is meant for portable C code. You’ll need to do some work to get [Voja’s] assembly code to work elsewhere. But if you do, you’ll have done something truly unique so email badge@hackaday.com and let us know about the accomplishment. Post your emulator with enough details about how you did it and you may find yourself on the front page for the gnarly hack.

If you are hacking on the crypto challenge, we want to know about it. Please Tweet your progress @Hackaday with the #SuperCon hashtag.

Filed under: cons, Hackaday Columns

PoisonTap Makes Raspberry Pi Zero Exploit Locked Computers

พฤ, 11/17/2016 - 02:31

[Samy Kamkar], leet haxor extraordinaire, has taken a treasure trove of exploits and backdoors and turned it into a simple hardware device that hijacks all network traffic, enables remote access, and does it all while a machine is locked. It’s PoisonTap, and it’s based on the Raspberry Pi Zero for all that awesome tech blog cred we crave so much.

PoisonTap takes a Raspberry Pi Zero and configures it as a USB Gadget, emulating a network device. When this Pi-come-USB-to-Ethernet adapter is plugged into a computer (even a locked one), the computer sends out a DHCP request, and PoisonTap responds by telling the machine the entire IPv4 space is part of the Pi’s local network. All Internet traffic on the locked computer is then sent over PoisonTap, and if a browser is running on the locked computer, all requests are sent to this tiny exploit device.

With all network access going through PoisonTap, cookies are siphoned off, and the browser cache is poisoned with an exploit providing a WebSocket to the outside world. Even after PoisonTap is unplugged, an attacker can remotely send commands to the target computer and force the browser to execute JavaScript. From there, it’s all pretty much over.

Of course, any device designed to plug into a USB port and run a few exploits has a few limitations. PoisonTap only works if a browser is running. PoisonTap does not work on HTTPS cookies with the Secure cookie flag set. PoisonTap does not work if you have filled your USB ports with epoxy. There are a thousand limitations to PoisonTap, all of which probably don’t apply if you take PoisonTap into any office, plug it into a computer, and walk away. That is, after all, the point of this exploit.

As with all ub3r-1337 pen testing tools, we expect to see a version of PoisonTap for sale next August in the vendor area of DEF CON. Don’t buy it. A Raspberry Pi Zero costs $5, a USB OTG cable less than that, and all the code is available on Github. If you buy a device like PoisonTap, you are too technically illiterate to use it.

[Samy] has a demonstration of PoisonTap in the video below.

Filed under: Raspberry Pi, security hacks, slider

How to Control Your Instruments From A Computer: It’s Easier Than You Think

พฤ, 11/17/2016 - 01:01

There was a time when instruments sporting a GPIB connector (General Purpose Interface Bus) for computer control on their back panels were expensive and exotic devices, unlikely to be found on the bench of a hardware hacker. Your employer or university would have had them, but you’d have been more likely to own an all-analogue bench that would have been familiar to your parents’ generation.

A GPIB/IEEE488 plug. Alkamid [CC BY-SA 3.], via Wikimedia Commons.The affordable instruments in front of you today may not have a physical GPIB port, but the chances are they will have a USB port or even Ethernet over which you can exert the same control. The manufacturer will provide some software to allow you to use it, but if it doesn’t cost anything you’ll be lucky if it is either any good, or available for a platform other than Microsoft Windows.

So there you are, with an instrument that speaks a fully documented protocol through a physical interface you have plenty of spare sockets for, but if you’re a Linux user and especially if you don’t have an x86 processor, you’re a bit out of luck on the software front. Surely there must be a way to make your computer talk to it!

Let’s give it a try — I’ll be using a Linux machine and a popular brand of oscilloscope but the technique is widely applicable.

It’s easy with a VISA

We are fortunate in that National Instruments have produced a standard bringing together the various physical protocols and interfaces used, and their VISA (Virtual Instrument Software Architecture) is available as precompiled libraries for both Windows and Linux(x86). Talking to VISA is a well-trodden path, for example if you are a Python coder there is a wrapper called PyVISA through which you can command your instruments to your heart’s content. And if you’ve spotted the glaring gap for architectures with no NI VISA library, they’ve got that covered too. PyVISA-py is a pure Python implementation of VISA that replaces it.

As a demonstration, we’ll take you through the process of using PyVISA-py and PyVISA on a Raspberry Pi for basic communication with an instrument over USB. We’ve used both a Raspberry Pi Zero and a Raspberry Pi 3 each running the latest Raspbian distro, but a similar path should apply to most other Linux environments and like instruments. Our instrument here is a Rigol DS1054z oscilloscope.

We start by installing the Python libraries for USB, PyVISA-py, and PyVISA. We’re assuming you already have python and pip, if not here’s a page detailing their installation. Type the following lines at the command prompt:

sudo pip install pyusb
sudo pip install pyvisa
sudo pip install pyvisa-py

You should now be able to test the installation from the Python interpreter. Make sure the instrument is both turned on and connected via USB, and type the following:

sudo python

This should give you a version and copyright message for Python, followed by a three-arrow >>> Python interpreter prompt. Type the following lines of Python:

import visa
resources = visa.ResourceManager('@py')

The first line imports the VISA library, the second loads a resource manager into a variable, and the third queries a list of connected instruments. The ‘@py’ in line 2 tells the resource manager to look for PyVISA-py, if the brackets are empty it will look for the NI VISA libraries instead.

If all is well, you will see it return a list of resource names for the instruments you have connected. If you only have one instrument it should be similar to the one that follows for our Rigol:


The part in the single quotes, starting with USB0:: is the VISA resource name for your instrument. It is how you will  identify it and connect to it in further code you write, so you will either need to run the Python code above in your scripts and retrieve the resource name before you connect, or as we are doing in this demonstration copy it from the prompt and hard-code it in the script. Hard-coding is not in any way portable as the script may only work with your particular instrument, however it does provide a convenient way to demonstrate the principle in this case.

If you are still within the Python interpreter at this point, you can leave it and return to the command prompt by typing a control-D end-of-file character.

Towards Something More Useful

Assuming all the steps in the previous paragraphs went smoothly, you should now be ready to write your own code. We’ll give you a simple example, but first there are a couple of pieces of documentation you’ll want to become familiar with. The first is the PyVISA documentation, the same as we linked to earlier, and the second should be the programming reference for your instrument. The manufacturer’s website should have it available for download, in the case of our Rigol it can be found as a PDF file (Click on the “Product manuals” link at the top).

The PyVISA manual details all the wrapper functions and has a set of tutorials, while the product manual lists all the commands supported by the instrument. In the product manual you’ll find commands to replicate all the interface controls and functions, but the ones we are most interested in are the measurement (MEAS) set of commands.

For our example, we’ll be measuring the RMS voltage on channel 1 of our Rigol. We’ll connect to the instrument directly using its resource name and querying it for its model identifier, before selecting channel 1 and querying  it for an RMS voltage reading.

Copy the following code into a text editor, replacing the resource identifier with that of your own instrument, and save it as a .py file. In our case, we saved it as query_rigol.py.

#Bring in the VISA library import visa #Create a resource manager resources = visa.ResourceManager('@py') #Open the Rigol by name. (Change this to the string for your instrument) oscilloscope = resources.open_resource('USB0::6833::1230::DS1ZA123456789::0::INSTR') #Return the Rigol's ID string to tell us it's there print(oscilloscope.query('*IDN?')) #Select channel 1 oscilloscope.query(':MEAS:SOUR:CHAN1') #Read the RMS voltage on that channel fullreading = oscilloscope.query(':MEAS:ITEM? VRMS,CHAN1') #Extract the reading from the resulting string... readinglines = fullreading.splitlines() # ...and convert it to a floating point value. reading = float(readinglines[0]) #Send the reading to the terminal print reading #Close the connection oscilloscope.close()

Enable the channel on the instrument – when you are familiar with the API you can do this with your software – and connect it to a signal. We used the ‘scope calibration terminal as a handy square wave source. You can then run the script as follows, and if all is well you will be rewarded with the instrument ID string and a voltage reading:

sudo python query_rigol.py

It’s worth noting, we have just run Python as root through the sudo command to use the USB device for the purposes of this demonstration. It’s beyond the scope of this page, but you will want to look at udev rules to allow its use as a non superuser.

With luck on this page we will have demystified the process of controlling your USB-connected instruments, and you should be emboldened to give it a go yourself. We’re not quite done yet though, the second part of this article will present a more complete example with a practical purpose; we’ll use our Raspberry Pi and Rigol to measure the bandwidth of an RF filter.

Filed under: Hackaday Columns, Raspberry Pi, Skills, slider, tool hacks

Crowdfunding: Oh Great, Now Anyone Can Invest In An Indiegogo Campaign

พุธ, 11/16/2016 - 23:31

Crowdfunding site Indiegogo has partnered with equity crowdfunding startup Microventures to allow anyone to invest in startups.

The comment sections of crowdfunding sites are almost as bad as YouTube. For every crowdfunding campaign that ships on time, you’ll find dozens that don’t. Thousands of people are angry their Bluetooth-enabled Kitten Mittens won’t be delivered before Christmas. Deep in the comments for these ill-conceived projects, you’ll find a common thread. The backers of these projects invested, and they demand a return. This, of course, is idiotic. Backing a project on Indiegogo or Kickstarter isn’t an investment. It is effectively burning money with the hope Kitten Mittens will eventually show up in your mailbox. Until now.

For an actual investment, there are regulations that must be met. The groundwork for this appeared last year when the Securities and Exchange Commission (SEC) introduced rules for equity crowdfunding. These rules include limitations on how much an individual may invest per year (a maximum of $2,000 or 5% of income, whichever is greater, for individuals with an income less than $100,000 per year), how much money these companies can raise ($1M in a 12-month period), and how an individual can invest in these companies.

Right now, the startups shown on Indiegogo and Microventures include an MMORPG, a distillery and cocktail bar in Washington, DC, a ‘social marketplace for music collaboration’, and a Bluetooth-enabled supercapacitor-powered “Gameball™”. All of these projects actually have documentation, and while the legitimacy of each crowdfunding project is highly dependent on the individual investor, there is a lot more data here than your traditional Indiegogo campaign.

This isn’t fire and brimstone and physics-defying electronic baubles raining down on the common investor, as you would expect from a traditional crowdfunding site tapping into the SEC rules on equity crowdfunding. This is, after all, only a partnership between Indiegogo and Microventures, one of the investment ‘funding portals’ that grew out of the equity crowdfunding regulations. In short, putting an investment opportunity up on Indiegogo will require more effort than a project that is just a few renders of a feature-packed smartphone or a video game with stolen assets.

If anything, this is just the continuation of what we’ve had for the past year. Since the SEC released the final regulations for equity crowdfunding, there have been a number of startups wanting to get in on the action. This partnership between Microventures and Indiegogo was perhaps inevitable, and we can only wonder who Kickstarter is about to team up with.

Filed under: Crowd Funding, Hackaday Columns