Laser arm

img_20180311_181008-600

Facelesstech published a new build:

So some time last year I ordered one of those servo 2 axes (pan and tilt torret) arm kits from aliexpress. It was fun to play with but I didn’t quite find a reason to use it in a project. Then I seen this project on hackaday and a light bulb went off in my head, Why hadn’t I thought about adding a laser to the arm. This would be great to let your cat or dog play with or drive them mad.

 

Check out the video after the break.

Modified Servo Adds Focus Control to Telescope

Scanning the heavens with a telescope is a great way to spend long, clear winter nights, but using a manual telescope can get to be a drag. A motorized mount with altitude and azimuth control is basic equipment for the serious observer, but adding a servo to control the focus of your telescope is one step beyond your average off-the-shelf instrument.

Having already motorized the two axes of the equatorial mount of his modest telescope as a senior project, [Eric Seifert] decided to motorize the focus rack as well. His first inclination was to use a stepper motor like he did on the other two axes, but with a spare high-torque servo at hand, he hacked a quick proof-of-concept. The servo was modified for continuous rotation in the usual way, but with the added twist of replacing the internal potentiometer with an external linear pot. Attached to the focus tube, the linear pot allows [Eric] to control the position and speed of the modified servo. Sounds like controlling the focus will be important to [Eric]’s planned web interface for his scope; we’ll be looking for details on that project soon.

We like the simplicity of this solution, and it’s a trick worth keeping in mind for other projects.  But if fancy steppers and servos aren’t your thing, fear not — astrophotography is as easy as slapping a couple of boards together with a hinge.


Filed under: misc hacks

Raspberry Pi and Alexa Make Teddy Ruxpin Smarter than the Average Bear

Behold the unholy union of Amazon’s Alexa and that feature-limited animatronic bear from the 80s, Teddy Ruxpin. Alexa Ruxpin?

As if stuffing Alexa inside a talking fish weren’t bad enough, now Amazon’s virtual assistant can talk to you through the creepy retro plush thanks to [Tinkernut]’s trip down memory lane. Having located a Teddy Ruxpin on eBay for far less than the original $70 that priced it out from under his childhood Christmas tree, [Tinkernut] quickly learned that major surgery would be necessary to revive the Ruxpin. The first video below shows the original servos being gutted and modern micro servos grafted in, allowing control of the mouth, eyes, and nose via an Arduino.

With the bear once again in control of its faculties, [Tinkernut] embarked on giving it something to talk about. A Raspberry Pi running AlexaPi joined the bear’s recently vacated thorax with the audio output split between the bear’s speaker and the analog input on the Arduino. The result is a reasonable animation, although we’d say a little tweaking of the Arduino script might help the syncing. And those eyes and that nose really need to get into the game as well. But not a bad start at all.

This isn’t the first time that Teddy Ruxpin has gone under the knife in the name of hacks, and it likely won’t be the last. And the way toy manufacturers are going, they might just beat us hackers to the punch.


Filed under: toy hacks

Real-Time Planet Tracker With Laser-Point Accuracy

Space. The final frontier. Unfortunately, the vast majority of us are planet-locked until further notice. If you are dedicated hobbyist astronomer, you probably already have the rough positions of the planets memorized. But what if you want to know them exactly from the comfort of your room and educate yourself at the same time? [Shubham Paul] has gone the extra parsec to build a Real-Time Planet Tracker that calculates their locations using Kepler’s Laws with exacting precision.

An Arduino Mega provides the brains, while 3.5-turn-pan and 180-degree-tilt servos are the brawn. A potentiometer and switch allow for for planet and mode selection, while a GPS module and an optional MPU9250 gyroscope/magnetometer let it know where you are. Finally a laser pointer shows the planet’s location in a closed room. And then there’s code: a lot of code.

The hardware side of things — as [Shubham Paul] clarifies — looks a little unfinished because the focus of the project is the software with the intent to instruct. They have included all the code they wrote for the RTPT, providing a breakdown in each section for those who are looking to build their own.

There is an extra step to auto-align the RTPT to north, otherwise you’ll have to do so manually. But [Shubham Paul] has designed it so that even if you move the tracker about, the RTPT will readjust its calculations in real time. Each part of the project includes a wealth of related information beyond simple instructions to adequately equip any prospective builders.

This hack gets the job done. If it’s looks you’re after, an artistic expression of maker skills and astronomy can be seen in this planetary map that relies on persistence of vision.


Filed under: Arduino Hacks, software hacks

DIY Mini Printer is 95% Wood, Prints Tiny Cute Images

This little DIY 64×64 graphical printer by [Egor] is part pen plotter in design, somewhat dot matrix-ish in operation, and cleverly designed to use unmodified 9G servos. The project page is all in Russian (translation to English here) but has plenty of photos that make the operation and design clear. Although nearly the entire thing is made from laser-cut wood, [Egor] says that a laser cutter is optional equipment. The first version was entirely cut with hand tools.

screenshot-2016-12-06-10-49-13Small DIY CNC machines driven over a serial line commonly use Arduinos and CD-ROM drive guts (like this Foam Cutter or this Laser Paper Cutter) but this build uses its own custom rack-and-pinion system, and has some great little added details like the spring-loaded clip to hold paper onto the print pad.

The frame and parts (including all gears) are laser-cut from 4 mm plywood and the unit is driven by three small servos. A simple Java program processes images and an Arduino UNO handles the low-level control. A video of everything in action is embedded below.

Speaking of rack-and-pinion setups using cheap servos, that idea was taken to the next level by this design for a 3-D printed linear actuator that uses unmodified servos.


Filed under: Arduino Hacks, cnc hacks

Blynk with Joy

Last time, I talked about how my storage situation and my cheap nature led me to build an RC joystick controller with a cell phone app and an ESP8266. The key to making this easy was to use the GUI builder called Blynk to make a user interface for an Android or Apple phone. Blynk can communicate with the ESP8266 and makes the project relatively simple.

ESP8266 and Arduino IDE

The ESP8266 Blynk code is straightforward. You do need to set up the Arduino IDE to build for the ESP8266. That can vary by board, but here’s the instructions for the board I was using (from Adafruit; see below).

adaesp

Depending on the type of ESP8266 device you are using, you may need a 3.3 V serial cable or some other means of getting the firmware into the device. For the Adafruit device I had, it has a 5 V-tolerant serial connection so a standard USB to serial dongle plugs right in. There’s also two switches on my device. To get into bootload mode, you have to push the one button down, hold it, and then press the reset button. Once you release the reset button you can release the other button. The red LED half-glows and the device is then waiting for a download.

Otherwise, things are just like usual with the Arduino IDE. You do have to be aware of what objects are available on the ESP8266 as opposed to a regular Arduino. There are some subtle differences, too. For example, the EEPROM object has some extra methods because the ESP8266 emulates an EEPROM (more on that later).

Virtual Pins and Processing

If you are getting started, you can just make a simple user interface with a push button and wire it to an LED on the board. That’s the Blynk “hello world” program. But for the joystick there are a few other considerations.

Instead of wiring a widget to a physical pin, you can use a virtual pin. Your program can then read and write these virtual pins easily. A “pin” in this context could be a bit, a number, or even a string.

To handle a virtual pin write (for example, a button push or a slider changing value), you write a function using the BLYNK_WRITE macro. For example:

// Flip S1
BLYNK_WRITE(V5)
{
if (!param.asInt()) return;
s1flip=!s1flip;
updates1();
updateEE();
}

The framework will call this code when the associated virtual pin (V5) changes. One word of caution: a button press gets two calls; one for the press and one for the release. You need to test the value if you want to only act on one or the other. That’s why the first line tests for the parameter value of zero and returns, thus ignoring the button release.

In addition to asInt() you can convert the parameter to other types, including float (asFLoat), double (asDouble), and string (asStr).

The BLYNK_READ macro lets you provide code that will run with the framework wants to read a virtual pin (that is, send data from the embedded system back to the phone). You can also call Blynk.virtualWrite to immediately update the value of a virtual pin.

The Code

You can find the code on GitHub. It is quite straightforward: Two Servo objects control the pulse output. Their duration is set by virtual pins from Blynk. Because the joystick is set to output the microsecond count directly, there’s not much to that.

To make things more interesting, I arranged for buttons that could flip the X and Y axis and also reflect either axis (that is, invert the axis so instead of reading 1000-2000, it reads 2000-1000). Each of those is just a button push that calls a BLYNK_WRITE function. There’s a line of code that makes the buttons only operate on one of the two events you get from a button push and release.

Of course, once you can configure the joystick (including a recenter option), it is a pain to lose the configuration on each restart. So I decided to allow writing the configuration to EEPROM. That was the start of a lot of trouble.

EEPROM Issues

The ESP8266 doesn’t have a true EEPROM. But the Arduino software emulates it with flash. When you want to use the EEPROM you have to inform the library how much memory you will use. It reads that memory from flash into a buffer. From that point on, all your EEPROM changes occur in the buffer. When you are done, you call end or commit and the library determines if you made changes. If you did, an entire flash page is erased and rewritten. If you call commit, you can make more changes (which then need to be written). If you call end, you are done.

By itself, that wouldn’t be a problem. However, watching the output on a scope, I noticed that when I would change configuration, sometimes–and only sometimes–the servo outputs would stall. The ESP8266 was still operating because the buttons that light LEDs would still work. I finally realized that any button that called for a EEPROM commit might hang the servo output. It wasn’t all the time, or even most of the time, but it was often enough to be annoying.

I tried a lot of things. Nothing completely fixed it. I finally resolved to have a “save” button so at least you know you might crash when you press it. Searching the Internet, this is a common problem. Since the simple code works, it seems as though the EEPROM code is disabling whatever timer interrupt the Servo object uses or not resetting the servo timer.

In the end, it mostly works, but any time you hit the save button, there’s a risk the servo output will die until the watchdog timer kicks in and resets the device.

Network Trickery

Of course, the ESP8266 has my local WiFi SSID and password plugged into it. You can set one up to act like a lot of modern devices where if it can’t connect it acts as its own access point so you can configure it. You could also just set it up as an AP and connect to it, assuming you can work out the Internet routing to get to the Blynk servers.

The problem is, I took the device into the office to show it off and realized that while my phone could connect to the corporate network, the ESP8266 wasn’t set up for it. I wasn’t carrying enough stuff to reprogram the device, but a solution dawned on me: I configured the hotspot on my phone to mimic the WiFi at home. With the same SSID and password, the joystick connected. Granted it was a little circuitous for the Blynk app to send data to the remote server, which sent it back to the phone which then routed it to the joystick, but it did work.

Final Analysis

Overall, using Blynk was pretty easy and worked pretty well. The EEPROM glitch didn’t seem to be a Blynk issue, so I can’t fault it for that. There were a few rough edges, though. For example, the LED buttons were inverted, but there was no simple way I could find to invert the operation of the buttons. That is, the buttons were on to send a high even thought that extinguishes the LEDs.

Using their server introduces some lag, but not nearly like I feared. If you have security concerns, you can run your own server, although I have not tried that. You still need “energy” for the app, though. I couldn’t decide how I felt about that. I understand that one has to make a living, and the joystick project fit in the free limits after all.

The other thing that would have been super would have been to be able to put the Blynk user interface in a browser. Blynk supports JavaScript, but as far as I can tell only as a remote platform, not as a host for the GUI. I understand that might cut into their revenue model, but it sure would be handy.

Speaking of which, you can field the Blynk embedded side into a lot of devices ranging from Arduinos, to MBed boards, to Raspberry PIs. You can connect via Ethernet, WiFi, Bluetooth, USB, and you can add your own connection methods.

This project didn’t even scratch the surface of the widgets you can use with Blynk. You can send e-mail, show video from a streaming server (like a web camera), or post to Twitter. There are gauges and sliders and lots of other things I didn’t need for the joystick.

If you don’t like Blynk, there are other options, although none of them struck me as quite as complete. For example, a quick scan of the Google Play Store shows quite a few similar apps. If you start weeding out the ones that won’t run on all the different platforms or work with Apple phones, you get a much shorter list. If you have experience–good or bad–with a different app, post in the comments.

Of course, you can always build your own phone app and communicate via standard networking. That’s actually not as hard as it sounds, but it isn’t as easy as using a tool like Blynk, either. Custom code can optimize what you are most worried about and will do exactly what you want. On the other hand, it would be a lot of work to support many different platforms, work on Google and Apple phones, and so on. For your application, though, that might not be as important as the control over the functions. That’s your call.

 


Filed under: Arduino Hacks, Featured, phone hacks

The Joy of the ESP8266 and Blynk

I’ll admit it. I can be a little cheap. I also find it hard to pass up a bargain. So when I saw a robot kit at the local store that had been originally $125 marked down to $20, I had to bite. There was only one problem. After I got the thing home, I found they expected you to supply your own radio control transmitter and receiver.

Normally, that wouldn’t be a problem but lately… let’s just say a lot of my stuff is in storage and I didn’t have anything handy. I certainly didn’t want to go buy something that would double the cost of this robot that I really didn’t need to begin with.

However, I did have a few ESP8266 modules handy. Good ones, too, from Adafruit with selected 5 V I/O compatibility and an onboard regulator. I started thinking about writing something for the ESP8266 to pick up data from, say, a UDP packet and converting it into RC servo commands.

joymainSeemed like a fair amount of work and then I remembered that I wanted to try Blynk. If you haven’t heard of Blynk, it is a user interface for Android and Apple phones that can send commands to an embedded system over the Internet. You usually think of using Blynk with an Arduino, but you can also program the embedded part directly on an ESP8266. I quickly threw together a little prototype joystick.

In this and a subsequent post, I’m going to tell you more about how all this went together and what I learned about the strengths and weaknesses of using Blynk on the ESP8266. There’s nothing specific about the code to the particular robot. The finished project looks like a standard two-channel RC controller sending pulses from 1 to 2 ms in length to indicate the joystick position on each axis.

The Plan

There’s not much to the joystick in theory. Forget the phone application and the networking for a minute. If you had two sensors (like, say, potentiometers), the output for the joystick is just a pair of pulses, one for each axis. These pulses typically drive servos. A 1.5 ms pulse means the sensor for that axis is at the center. A 2 ms pulse means it is at one extreme and a 1 ms pulse means it is at the other extreme. Everything else is to scale. So if the X pulse is at 1.2 ms and the Y pulse is at 1.9 ms, then the X axis is a little off center one way, and the Y axis is a little off center the other way.

In this case, our sensors are the joystick widget on the phone screen. That’s the hard part, but thanks to Blynk, it really isn’t that hard at all.

Inside Blynk

The GUI part of Blynk is really simple. You build a screen, add widgets and tap them to configure them. The joystick has some basic configuration items (see figure, below) and you can set its range (which we’ll set to 1000 to 2000 to match the pulse with in microseconds).

When you create a Blynk app, you generate a long hex number that identifies your application. That number is the key to connecting your microcontroller to the user interface.

The basic steps are easy:

  • Open Blynk and create a new project
  • Select a project name and the type of hardware you’ll use
  • The software will show you an “auth token” (the long hex number)
  • You can write the number down or press a button to have it sent to your e-mail (much easier)
  • Press the create button and you’re done

joypropAt the top of the screen you’ll see a + sign. You can use that to add various widgets (switches, LEDs, and–of course–the joystick control). You can build your interface and set different properties on each widget that controls its appearance and behavior.

 

To get it all to work, you load the Blynk embedded-side code into your processor. You’ll also have to add the  ID number and do whatever it takes to get network connectivity (e.g., add your network SSID and password). For a lot of things, that’s all you have to do.

When your program runs, it connects to the Blynk server and since it has that ID, it will connect to the phone GUI (assuming it is open). For simple things, you don’t need anything else. You can connect buttons and LEDs and sliders and similar items from the Blynk widget set directly to physical pins on your device. Connect a button to a pin connected to a physical LED and you can turn the LED on and off. Connect an LED to a input switch on the microcontroller and you can light the virtual LED by pushing the button.

Things like sliders and gauges can use analog output (PWM) and analog inputs. So “pin” doesn’t necessarily mean a single digital bit.

Sometimes connecting widgets to physical I/O all you need. Some widgets can do things like scale numbers (so 0-255 turns into 0-100, for example) that reduces the need to do anything custom. However, sometimes you need custom code. For these cases, you can use virtual pins that I will describe later.

The app, by the way, is free… sort of. You are given a certain amount of “energy” to spend. When you use a widget, it consumes a certain amount of energy. If you delete a widget, you get the energy back. If you are out of energy, you can’t add any more widgets. Unless, that is, you buy more energy. I know the Internet has conditioned us to think everything should be free, but this is a fair compromise. The joystick left me with no energy, so it didn’t cost me anything to deploy, but unless I delete it, I can’t make anymore Blynk interfaces without paying for more energy.

Next Steps

To complete the joystick project, you’ll need to tackle the following issues:

  • Programming the Blynk firmware into the ESP8266
  • Communicating with the Blynk user interface from your custom code

Neither of these are especially hard, as I’ll show you next time. For the joystick, there’s no need to send data from the ESP8266 back to the phone, although that’s certainly possible.

We’ve covered Blynk before, but I wanted to do a complete project just for Hackaday (not that we haven’t seen plenty of projects out there). If you want to follow along, grab an ESP8266, download Blynk, and stay tuned for the next installment.


Filed under: Android Hacks, phone hacks

Hackaday Links: November 27, 2016

[Prusa]’s business is doing great. This year, he released the Prusa i3 Mk. 2, a four color upgrade to the printer, and sales are through the roof. There’s just one problem: Paypal just locked his funds. Prusa is turning away from Paypal and given Paypal’s history, this will eventually be worked out. Be warned, though: don’t use Paypal for your hardware business. We’ve seen this same story played out too many times before.

Those millennials are always on their phones. How do you get rid of that distraction? Airplane mode? No, that’s stupid. Put those phones in a metal box. It’s the exact same thing as airplane mode – which is free – but this extra special metal box costs $45 and ships in March. Is this metal box different from any other metal box, like a cookie tin, perhaps? Probably not.

Nothing to see here, folks.

The holidays are here, and it’s time for Cards Against Humanity to do something stupid with other people’s money. This year, they’re throwing money into a hole. No, really. People are contributing money to dig a gigantic hole. There’s a livestream of the digging. Five dollars lets the dig continue for another few seconds. Join in on the holiday spirit: throw your money into a hole.

You don’t want to throw your money into a hole? Buy some stuff on Tindie! There’s robots, CNC controllers, servo drivers, MIDI arpeggiators, USB testers, power supplies, blinky glowy things, and retro gaming stuff. Go plug your Raspberry Pi into some of these gizmos.

The Mechaduino is a board that clips onto a ubiquitous NEMA stepper motor to turn it into a servo motor.  It won 5th place in the Hackaday Prize last month, and we can’t wait to see it integrated into a closed-loop 3D printer. [Chris] came up with an Ethernet-enabled servo-stepper conversion, and now it’s a project on Kickstarter. Of course, you can buy a Mechaduino right now, making the future of stepper motor-controlled desktop CNC very interesting.

Individually addressable RGB LEDs exist, and we’re waiting for Clark Griswold to electrify his house in red, green, and blue. Until then, [Michel built a holiday ornament loaded up with 16 WS2812b LEDs. The star features caps and diodes to make everything work as it should and requires only three wires per star.


Filed under: Hackaday Columns, Hackaday links

Hackaday Links: November 27, 2016

[Prusa]’s business is doing great. This year, he released the Prusa i3 Mk. 2, a four color upgrade to the printer, and sales are through the roof. There’s just one problem: Paypal just locked his funds. Prusa is turning away from Paypal and given Paypal’s history, this will eventually be worked out. Be warned, though: don’t use Paypal for your hardware business. We’ve seen this same story played out too many times before.

Those millennials are always on their phones. How do you get rid of that distraction? Airplane mode? No, that’s stupid. Put those phones in a metal box. It’s the exact same thing as airplane mode – which is free – but this extra special metal box costs $45 and ships in March. Is this metal box different from any other metal box, like a cookie tin, perhaps? Probably not.

Nothing to see here, folks.

The holidays are here, and it’s time for Cards Against Humanity to do something stupid with other people’s money. This year, they’re throwing money into a hole. No, really. People are contributing money to dig a gigantic hole. There’s a livestream of the digging. Five dollars lets the dig continue for another few seconds. Join in on the holiday spirit: throw your money into a hole.

You don’t want to throw your money into a hole? Buy some stuff on Tindie! There’s robots, CNC controllers, servo drivers, MIDI arpeggiators, USB testers, power supplies, blinky glowy things, and retro gaming stuff. Go plug your Raspberry Pi into some of these gizmos.

The Mechaduino is a board that clips onto a ubiquitous NEMA stepper motor to turn it into a servo motor.  It won 5th place in the Hackaday Prize last month, and we can’t wait to see it integrated into a closed-loop 3D printer. [Chris] came up with an Ethernet-enabled servo-stepper conversion, and now it’s a project on Kickstarter. Of course, you can buy a Mechaduino right now, making the future of stepper motor-controlled desktop CNC very interesting.

Individually addressable RGB LEDs exist, and we’re waiting for Clark Griswold to electrify his house in red, green, and blue. Until then, [Michel built a holiday ornament loaded up with 16 WS2812b LEDs. The star features caps and diodes to make everything work as it should and requires only three wires per star.


Filed under: Hackaday Columns, Hackaday links

A Dual-purpose Arduino Servo Tester

RC flying is one of those multi-disciplinary hobbies that really lets you expand your skill set. You don’t really need to know much to get started, but to get good you need to be part aeronautical engineer, part test pilot and part mechanic. But if you’re going to really go far you’ll also need to get good at electronics, which was part of the reason behind this Arduino servo tester.

[Peter Pokojny] decided to take the plunge into electronics to help him with the hobby, and he dove into the deep end. He built a servo tester and demonstrator based on an Arduino, and went the extra mile to give it a good UI and a bunch of functionality. The test program can cycle the servo under test through its full range of motion using any of a number of profiles — triangle, sine or square. The speed of the test cycle is selectable, and there’s even a mode to command the servo to a particular position manually. We’ll bet the build was quite a lesson for [Peter], and he ended up with a useful tool to boot.

Need to go even further back to basics than [Peter]? Then check out this primer on servos and this in-depth guide.

[via r/Arduino]


Filed under: Arduino Hacks, misc hacks