Byte Sized Pieces Help The KiCad Go Down

It’s no surprise that we here at Hackaday are big fans of Fritzing KiCad. But to a beginner (or a seasoned veteran!) the learning curve can be cliff-like in its severity. In 2016 we published a piece linking to project by friend-of-the-Hackaday [Chris Gammell] called Contextual Electronics, his project to produce formalized KiCad training. Since then the premier “Getting to Blinky” video series has become an easy recommendation for anyone looking to get started with Libre EDA. After a bit of a hiatus [Chris] is back with bite sized videos exploring every corner of the KiCad-o-verse.

A Happy [Chris] comes free with every videoThe original Getting to Blinky series is a set of 10 videos up to 30 minutes long that walks through everything from setting up the the KiCad interface through soldering together some perfect purple PCBs. They’re exhaustive in coverage and a great learning resource, but it’s mentally and logistically difficult to sit down and watch hours of content. Lately [Chris] has taken a new tack by producing shorter 5 to 10 minute snapshots of individual KiCad features and capabilities. We’ve enjoyed the ensuing wave of learning in our Youtube recommendations ever since!

Selecting traces to rip up

Some of the videos seem simple but are extremely useful. Like this one on finding those final disconnected connections in the ratsnest. Not quite coverage of a major new feature, but a topic near and dear to any layout engineer’s heart. Here’s another great tip about pulling reference images into your schematics to make life easier. A fantastic wrapped up in a tidy three minute video. How many ways do you think you can move parts and measure distances in the layout editor? Chris covers a bunch we hadn’t seen before, even after years using KiCad! We learned just as much in his coverage of how to rip up routed tracks. You get the idea.

We could summarize the Youtube channel, but we aren’t paid by the character. Head on down to the channel and find something to learn. Make sure to send [Chris] tips on content you want him to produce!

Posted in Chris Gammell, contextual electronics, eda, instruction, KiCAD, layout, learning, libre eda, pcb, schematic, tool hacks, tutorials | Leave a comment

Simple Ultrasound Machine Shows The Skeleton Lurking Inside Us All

That first glimpse of a child in the womb as a black and white image on a screen is a thrilling moment for any parent-to-be, made possible by several hundred thousand dollars worth of precision medical instrumentation. This ultrasound machine cobbled together from eBay parts and modules is not that machine by a long shot, but it’s still a very cool project that actually gives a peek inside the skin.

The ultrasound transducer used by [stoppi71] in this build has an unusual source: a commercial paint-thickness meter. Cue the jokes about watching paint dry, but coatings measurement is serious stuff. Even so, the meter in question only ran about $40 on eBay, and provided the perfect transducer for the build. The sender needs a 100V pulse at about 5 MHz, so [stoppi71] had some fun with a boost converter and a 74121 Schmitt-trigger one-shot driving a MOSFET to switch the high voltage. On the receive side, the faint echo is sent through a three-stage amp using AD811 op amps before going through an LM7171 op amp acting as a rectifier and peak detector. Echos are sent to an Arduino Due for display on a 320×480 LCD. The resolution isn’t great, but the video below shows that it’s enough to see reflections from the skin of [stoppi71]’s forearm and from the bones within.

[stoppi71] says that he was inspired to tackle this build by Murgen, an open-source ultrasound project. That project got further refined and entered into the “Best Product” category in the 2018 Hackaday Prize. We like that because focusing on turning projects into products is what this year’s Hackaday Prize is all about.

Posted in 74121, Arduino DUE, boost converter, LM7171, Medical hacks, pulse, SD811, transducer, ultrasound | Leave a comment

The 6502 Watch, Because Someone Had To Make One

We are very familiar with retrocomputers, and if you want you too can build a computer that could have been made in the late ’70s on a breadboard. Just grab your CPU of choice, add some RAM, some ROM, a ton of jumper wires, and give it some way to talk to the outside world. The problem with the computers inspired by yesteryear is that they all, inexplicably, use through-hole parts. If only someone used the small QFP parts instead of the big chonkin’ PDIPs, we could have really small retrocomputers. That’s exactly what [NotArtyom] did, and he managed to come up with a wearable 6502 watch.

The system design for this 6502-based watch is fairly standard for what you would find in any other retrocomputer. There’s a PLCC 6502, 32k of SRAM, 16k of ROM, and a PLLC’d 6522 for a bit of IO. There are a few peripherals hanging off the 6522, and since this thing is a watch the most important is a real time clock. There’s also a Nokia LCD and a 20-pin Commodore keyboard connector.

Software-wise, most of the ROM is dedicated to G’Mon, a generic monitor that can view and modify memory. There’s also EhBasic, and a kernel to handle the RTC, keyboard, and display.

Whether or not this is a useful smartwatch isn’t the question; this is one of the first retrocomputer projects we’ve seen that lean into the non-PDIP versions of these classic chips. This is a bit surprising, because you can still buy these parts, PDIP or not, new from the usual vendors. If nothing else, it’s a demonstration of what can be done with modern IC packages.

Posted in 6502, 6522, classic hacks, news, PDIP, plcc, watch | Leave a comment

Here’s A Tesla Coil You Can Wear

It’s badgelife season, and if you need an idea for a killer piece of wearable electronics, look no further than this PCB Tesla coil. Yes, it’s killer, doubly so if you’re wearing a pacemaker.

This project was inspired by an earlier Tesla coil on a PCB project that used 160 turns of 6 mil traces on a circuit board as the secondary. All the electronics are there, and it’s powered by USB. Plug this thing in, and you have a pocket full of lightning that’s approximately 30kV. It probably won’t kill you if you touch it, but let’s not test that too much. [Bobricious] took this idea and ran with it, stripping the circuit down to its bare minimum. Now it’s just a single transistor, with all the other parts printed on a circuit board.

There is one problem with making a Tesla Coil on a PCB, and that’s the number of turns on the coil. Any Tesla coil you’ll find is really just the clever application of a single thin wire wrapped around itself a few hundred or thousands of times. This Tesla coil is no different, and in this case it’s 240 turns of a single trace wrapping around a PCB that is 150mm square. [Bobricius] is one of the kings of putting tiny coils on a PCB, and his fiberglass brushless motor is a testament to that. We also just covered his circular linear motor raceway which also uses PCB coils.

The circuit is simple, just a power jack that accepts something around 20 Volts, a single BD243 transistor, an LED, and an 82k resistor. With that, you can lay a small neon tube on the PCB and watch it light up. With another PCB and another neon tube, this circuit board can transfer wireless power. It’s a fun toy, and it’s all PCB tech.

Posted in 2019 Hackaday Prize, art, pcb, tesla coil | Leave a comment

Teardown: The Guts of a Digital Sentry

I have a home alarm system that has me wondering if I can make it better with my maker Kung-fu. Recently we had to replace our system, so I took the time to dissect the main controller, the remote sensors, and all the bits that make a home security system work.

To be precise, the subject of today’s interrogation is a Zicom brand Home Alarm that was quite famous a decade ago. It connects to a wired telephone line, takes inputs from motion, door, and gas sensors, and will make quite a racket if the system is tripped (which sometimes happened accidentally). Even though no circuits were harmed in the making of this post, I assure you that there are some interesting things that will raise an eyebrow or two. Lets take a look.

The Gateway of the Zicom Home Alarm System

The front panel is simple with a keyboard and an LCD display and a quick search on Aliexpress yields similar units still available. A number pad and a few other keys are the only way to configure the system to add sensors, set alerts, activate, and deactivate the alarm. Unfortunately there is no USB port to allow PC based configuration and the complicated process of using this gateway makes it rather user unfriendly.

Under the hood, there is a lot of classic design work to be found. Here is a list of the most prominent looking blobs on the PCB inside.

  1. STC89C54RD+ –[Microcontroller] [PDF]

  2. 24C18 EEPROM [blurry]

  3. HT1380 – RTC (PDF)

  4. LM339 – Comparator

  5. HT1621B – LCD Driver (PDF)

  6. 74HC164B – SIPO

  7. HT9170D – DTMF Receiver

  8. SMC0100 PD61AA266M – Alarm Tone Generator?

  9. LM380 – Audio Amp

  10. ST HCF4052 – Analog Mux/Demux (PDF)

  11. Some power regulators and a standard 433MHz RF Receive Module(AM)

Lets start (guessing) from the top. The 8051 variant(1) is obvious and I guess handles the basic operations of the system. The EEPROM(2) is interesting and should be the place where the system stores configurations such as the phone numbers to be called and the ID of the sensors that have been paired with the system.

We also see a HT1380(3) serial RTC which exposes a serial interface and even though the 8051 variant does have a dedicated SPI peripheral, there are firmware tricks to bit bang effectively.

The controller should also be talking to the dedicated Holtek LCD Controller(5) via the 3 wire serial interface. Bit bang anyone? LM339s I found would be a good fit to buffer external inputs and 74HC164s serial-in-parallel-in chips are used to control wired alarms or control external relays and such.

The ST HCF4052 is an Analog Mux-Demux and was a bit of a surprise in an all digital system.

There is a DTMF decoder(7) which I assume is how a user would deactivate the alarm remotely by entering a code and then doing some other single digit commands. You don’t want your neighbors throwing rocks to silence a blaring alarm in your absence. The analog Mux-Demux could be used to switch the Decoder and dialing system to the phone lines, though relays are traditionally used for that task.

The RF part is interesting and uses what looks to be a hobby grade module which means that in order to snoop on the system, all you would need is an Arduino and a similar module. The funny thing is that the microcontroller is running at around 3 MHz and with a 6T/12T clock machine cycle. That puts the core at 250kHz in the worst case. The firmware would have to be pretty tightly knit. My guess is that the Timer/counter peripherals are used to count pulse widths from the RF modules and then pushed into a common buffer which is then read by the main routine and such.

The last part is the vertically soldered PCB with a custom chip inside. Any guesses?

Exploring the Door Sensor

Since everything is 433MHz, the sensor nodes are simple little creatures that I guess, chirp every now and then. There is evidence of a small SOIC microcontroller on the door sensors, but the part number is not visible. A crystal suggests a smaller 8051 variant that supports lower power consumption waiting for a GPIO interrupt which would trigger the transmission. There is no receive module which means that getting an acknowledgement is out of the question and there would also be a code for sending a low battery alert.

The R433A TO39[PDF] metal-can seen in the image is a SAW Resonator commonly found in AM Transmitter modules and the sensor of choice is a reed switch that provides the requisite interrupt to the microcontroller. Wax-on, wax-off. There is a write-up on The Mechanics of a Reed Switch that you may find useful.

There are no regulators so the two AAA cells provide 3.0V and below to power the system. Its simple and gets the job done.

The Motion Sensor

PIR motion sensor PCB

The motion sensor is more interesting, with a Toshiba TMP87P808 Microcontroller [PDF] in it. Personally, I’ve never used that part but a quick google search reveals that a bunch of companies in China use it and its relatives for lower power applications. Cool!

The sensing element is a Pyroelectric IR sensor[PDF] common in intrusion detection systems. There are variants available in the market with multiple sensor elements and other bells and whistles.

I was surprised at how low power the module was since it kept working for around 4 years on three AA batteries. The batteries leaked in one of the modules killing the PCB which adds to the list of lessons learned in my humble opinion.

An R433 SAW resonator powers the RF end of the device in the same fashion as the door sensor and typically it is also the most power hungry piece of the puzzle.

The Gas Sensor and Power Supply

The gas sensor we have is a wall plug type and is the largest of all the sensors in the lot and understandably so. Most gas sensors traditionally employed a sensor with a heating element inside and with great heat comes great power loss. A lot of these sensors can be purchased online at reasonable prices but special sensors such as O2 and special gas sensors are still uncommon. Mems sensors have come to replace these and are much more affordable while providing accuracy and efficiency hence the modern-day fire alarm’s small size.

In a country like India, where power cuts are common occurrence, it is important to have a backup power supply. The system came with a rather large wall-wart with a NiCd cells and a charging circuit along with a step down transformer. The output is a standard barrel jack and no way of telling the main system of the backup power levels.

The Alert Mechanism

In addition to the small speaker the system can talk to an external alarm buzzer which suggests that there is an AM transmitter module somewhere on the control module. Once triggered, the system will call a predefined phone number via a wired telephone line and then wait for the user to enter a code via DTMF.

That seems to be the extent of the connectivity and if someone were to cut the hardline (Matrix movies anyone?) the system would be stuck screaming until someone manually deactivates it or the power dies. We have had an interesting experience with a weather storm falsely triggering the system in the middle of the night with phone lines down and some angry neighbors. No rocks though.

Sniffing Wireless Communication

Using an SDR Dongle, it would be easy to snoop around the wireless transmissions. Batteries and a button press on the door sensor resulted in these transmissions which I am assuming contains the ID code as well as other pairing data for the sensor.

The same transmission happens six times after I press the button on the PCB. Typically RF 433 MHz sensors use line codes such as On-off keying, Manchester, or Biphase Mark. If the manufacturer follows standard protocols, it may be possible to use software such as rtl_433 or Universal Radio Hacker to automate the process somewhat. We have even seen the use of Matlab for reverse engineering this stuff.

This is one of the reasons why many commercial solutions would provide wired connections to their sensors. Alternatively, chips with rolling codes could be used as well but wired systems also come with the benefit of never having to change batteries. After all, motion sensors in a busy office would drain the cells more quickly than a sensor in a home.

Conclusion

This system is a decade old, and things have changed for the better but the principles are the same. The system is designed to be cost effective while delivering a certain level of service. It has its flaws but is a good learning point. With the information we have collected, it should be possible to design a custom solution which is exactly what I have done so stay tuned.

Posted in alarm system, Hackaday Columns, home hacks, security system, teardown | Leave a comment

Cocktail Barbot Takes Things Up A Level

Mixing a cocktail is considered as much an art as a science. The practice is studied dilligently by bartenders the world over. Of course, for any given human task, there’s always another human building a robot to automate it. [CamdenS5] is one such human, with a cocktail mixing barbot with a few tricks up its sleeve.

As you’d expect, there’s a smattering of the usual alcoholic liquids and mixers, along with a battery of pumps for fluid delivery. The fun doesn’t end there, though. There’s a linear actuator capable of putting out 500 N for slicing limes, and a mint and sugar dispenser as well. If that wasn’t enough, there’s even a muddling station to help bring out the flavours just right.

This is a machine that takes a broader look at the process behind making a good cocktail. It’s not just about lumping ingredients into a glass – it takes finesse and care to get the best results. It’s not the first barbot we’ve seen – this one is built in a grandfather clock.

Posted in barbot, cocktail bot, cocktail machine, cocktail robot, home hacks | Leave a comment

Shitty Add-Ons Go Electroluminescent

It’s that time of the year again, and once more we’re faced with the latest innovations in Badgelife, the movement to explore the artistic merits of electronics and manufacturing. This is an electroluminescent printed circuit board, and it’s some of the finest work we’ve seen. It’s also a Shitty Add-On that glows blue.

The process for applying an electroluminescent coating to printed circuit boards is, surprisingly, something we’ve covered before. Late last year, [Ben Krasnow] delved deep into a DIY EL display. The process is expensive, but all the products come from a company called Lumilor. The first step in this process is applying a thin conductive coating on a substrate with an airbrush. Since the entire idea of printed circuit boards is to have a layer of conductive material etched into any shape you want, the simple circuit board is the idea experimental platform for playing with EL displays. Traditionally, EL displays were made entirely with a silk screen process, like [Fran]’s ongoing attempt to recreate the Apollo DSKY display.

The electronics for this badge are simply a Microchip MIC4832 EL Driver, which converts the 3.something volts from the Shitty Add-On header into 100 or so Volts AC at hundreds of Hz. This is a single-chip solution to driving EL displays, and the only other parts you need are an inductor, diode, and a few caps and resistors. An ATtiny85 can be used to blink the circuits, or, alternatively, you could copy [Ben]’s work and build a character EL display.

The process of applying an electroluminescent coating to a PCB does require a spray gun or airbrush, and the chemicals are a bit expensive. This, though, is pushing the boundaries of what can be done with artistic PCBs. It’s new applications of technology, simply as wearable electronics. It’s the best example of the possibilities of the medium and some of the best work that’s come out of the Badgelife scene.

Posted in badgelife, el, EL display, electroluminescent, hardware, pcb | Leave a comment

Pocket Watch Becomes Pinhole Camera

A pinhole camera is essentially the combination of the camera obscura with photographic film. The pinhole acts as the lens, focusing the scene onto the film, and after exposure, the film can then be developed and you’ve got your picture. They’re a fun way to learn about photography, and easy to make, too. [Brooklyntonia] decided to undertake just such a build, secreted away inside a pocket watch.

The build starts with with the disassembly of the watch, which acts as the main cavity of the camera. A bellows is then constructed from leather and a toilet paper roll to allow the camera to still fold up inside the original watch case. A pinhole is then installed at the end of the bellows, and a plug is used as a shutter to allow the bellows to be properly unfolded prior to exposure.

It’s a fun build, and one that comes complete with instructions for the proper processing of film in your own darkroom – or bathroom. Pinhole cameras can be useful tools, too – particularly for things such as capturing an eclipse.

Posted in camera, classic hacks, misc hacks, pinhole camera, pocket watch | Leave a comment

The Science Of Reverse Mounted LEDs

One of the most artistic applications of electrical engineering in recent memory is the burgeoning badgelife movement. This is an odd collective of people who are dedicating their time to rendering their own accomplishments in printed circuit boards. Of the entire badgelife collective, one of the most visible efforts are in Shitty Add-Ons, with a particular focus on reverse-mounted LEDs. Yes, you can install SMD LEDs upside down, and if you have your copper layers right, the light will shine through the badge.

One of the most prominent users of reverse mounted LEDs is [TwinkleTwinkie], and now finally we have a writeup on the science of reverse mounted LEDs. There’s a lot to unpack here, so buckle up and prepare to burn the tips of your fingers on a soldering iron.

For truly reverse-mounted PCBs, there are two options. The first, and most expensive, are ‘reverse gullwing’ LEDs. These LEDs are just like normal LEDs, except the SMD pads are reversed, allowing you to mount it so the light shines into the PCB. These LEDs are expensive, rare (only three companies make them), and they don’t really give off a lot of light. The other solution to reverse-mounting a LED is simply taking a standard 1206 SMD LED and manually soldering it upside-down. This is not pick and place friendly, although I’m sure you could find an LED manufacture that would put LEDs in reels upside-down if you want.

Side view LEDs

The takeaway for reverse mount LEDs is pick two: good, fast, or cheap. Reverse gullwing LEDs are expensive, but can be pick and placed and provide sufficient illumination. Hand-soldered LEDs installed upside down are cheap, slow, but also good.

But there is another option. Side view LEDs are a thing, and they can be pick and placed. You can get them in every color, and even UV. [Twinkle] has experimented with side-view LEDs in place of reverse mounted LEDs, and the results are promising. By putting the side view LED next to part of a PCB without copper or soldermask, there is some light bleed through the PCB. It’s somewhat uneven, but with a hot melt glue diffusor, you can get a somewhat decent bar of light being emitted through a PCB.

If you want to put blinky on a PCB, you have a lot of options. If you want to put blinky on a PCB without having any visible light source, these are your options. This is the state of the art in artistic PCBs, and we’re so glad [Twinkle] could share it with us.

Posted in art, badge, badgelife, reverse mount LEDs | Leave a comment

What Can You Learn From an Eggbot?

An eggbot is probably the easiest introduction to CNC machines that you could possibly hope for, at least in terms of the physical build. But at the same time, an eggbot can let you get your hands dirty with all of the concepts, firmware, and the toolchain that you’d need to take your CNC game to the next level, whatever that’s going to be. So if you’ve been wanting to make any kind of machine where stepper motors move, cut, trace, display, or simply whirl around, you can get a gentle introduction on the cheap with an eggbot.

Did we mention Easter? It’s apparently this weekend. Seasonal projects are the worst for the procrastinator. If you wait until the 31st to start working on your mega-awesome New Year’s Dropping Laser Ball-o-tron 3000, it’s not going to get done by midnight. Or so I’ve heard. And we’re certainly not helping by posting this tutorial so late in the season. Sorry about that. On the other hand, if you start now, you’ll have the world’s most fine-tuned eggbot for 2020. Procrastinate tomorrow!

I had two main goals with this project: getting it done quickly and getting it done easily. That was my best shot at getting it done at all. Secondary goals included making awesome designs, learning some new software toolchains, and doing the whole thing on the cheap. I succeeded on all counts, and that’s why I’m here encouraging you to build one for yourself.

What is an Eggbot?

Eggbots first entered my consciousness through Evil Mad Scientist’s EggBot kit. It’s the most refined that we’ve seen, and if you’re making your own machine it’s worth looking at where EMSL include adjustability in their design. But as promised, even a fancy one like this doesn’t have too much going on with the hardware side of things. Your bare-bones version only needs two stepper motors, a micro servo motor to lift the pen, maybe a skateboard bearing and some threaded rod here and there to make it adjustable and smooth. And of course, you’re going to need the electronic bits to drive it all.

Conceptually, one stepper rotates the egg around its axis of symmetry, the other rotates the pen’s axis so that it can travel north-south, and the servo lifts up the pen between strokes.

For motors, I used what I had on hand, and you probably can too. I bought a big handful of these discount NEMA 17 steppers from a local German supplier, and although they were cheap, they’re probably over-spec for an Eggbot with 0.34 Nm worth of torque. I’ve seen machines that use the ridiculously cheap 28-BYJ48-type gear motors as well, so even those could be made to work. The number of steps is key, and more is better, so you probably don’t want to use any old pancake stepper you find, for fear that you’ll get a low-step variant. For the pen, a servo is a servo, but you want a small one.

The particular frame I ended up with was a variant of this 3D model but redesigned to print without supports. It’s maybe not as flexible as the original, but tossing someone else’s design at a 3D printer is definitely the low-hassle way to go: download, slice, print, and come back in ten hours. If you’ve got a lot of threaded rod lying around, and want the extra flexibility, I’d consider this battle-tested frame or one of its derivatives.

But even if you don’t have a 3D printer, the mechanics of an eggbot make very light demands on the home builder. All motors are driven directly, so there’s no gearing to worry about. Eggs are light, so you don’t need to sweat about torque. And there’s almost no side-load on the pen tool, so you don’t have to worry particularly about frame rigidity. Have a look at [Zaggo]’s SphereBot made of MDF scraps, or [derwassi]’s CNC Eggbot made of thin plywood for inspiration.

The electronics include two stepper motor drivers and a microcontroller to run the show. I went online to look for Pololu-style A4988 stepper drivers, because I’d used them ages ago in building a 3D printer. I remembered them to cost around $10 each, so I was looking at $20 and a bunch of DIY work. Instead, I found a complete kit with “Arduino”, shield, four (4!) stepper drivers, and even a USB cable thrown in for €15, delivered. Search “arduino grbl cnc shield”, do not collect $200, do not pass Go, and head directly to checkout. Maybe pick up two, because they’re an incredible bargain, and you can’t beat it for development time spent on the electronics side of things. Without the “Arduino” you can get one for €7 and use whatever micro dev board you’ve got sitting around, but you’ll have to do the wiring yourself.

I splurged. After all, minimizing my time and effort spent on the project was the prime directive. Other than soldering compatible headers to my servo motors, everything was plug-and-play. If you haven’t bought oddball servos, you might not even need to warm up the iron. Splurging unfortunately meant waiting, though, and I sat around for a week and a half with a printed and assembled eggbot on my shelf, waiting for electronics, cursing my laziness. Total human time spent on the project, under two hours, and most of that was browsing 3D printed frames online and re-designing some 3D-printed parts to work around my oddball servos. So I guess the waiting pays off.

Wares: Firm- and Soft-

“And the rest is a simple matter of software.” While sourcing all the parts and building the bot took two hours, I spent at least that long looking for the right combination of software and firmware to drive this thing. Learning to use what would become a toolchain took four or five more. I’ll spare you as much of that learning curve as possible.

The plan was to have the eggbot deal in plain-jane G-code because it’s the lingua franca of CNC machines. This is where we part ways with Evil Mad Scientists, because they use a proprietary protocol, even if it is open, well-documented, and frankly pretty well thought out. If you just want eggs pronto, that’s a good way to go. But if you want to apply what you learn here to any other CNC machines, from DIY 3D printers to the fanciest of multi-axis industrial milling machines, you’re going to want to deal in G-code. I needed an ATmega328 G-code interpreter.

Since the dirt-cheap motor-driver board I’d bought was designed to run with GRBL, that was an easy choice. As a bonus, all of my 3D printers use Marlin, so I got to learn something new. The only catch is that GRBL wants to exclusively drive stepper motors, and we have a servo in the mix. There have actually been a number of hacks to GRBL to enable the CNC spindle-speed command to control the servo position, which would be useful if I needed accurate position control, but for the eggbot, simple up-down control will suffice, and it’s nicer conceptually to tie that to the Z-axis height. Hackaday friend, buildlog.net founder, and all around good guy for things CNC [Bart Dring] had just such a firmware hacked together already.

To build up Bart’s firmware yourself, you can download the latest GRBL, then download Bart’s modifications and copy them over the original files. Or just download this repository where I already did that for you. You will want to change the PEN_SERVO_DOWN and PEN_SERVO_UP lines in spindle_control.c to tweak how far the servo moves for pen up and pen down commands. It’s on a scale of 0-255, and 127 is halfway. After this setting, you’re just a make flash away from installation. Arduino folks, you can also compile it in the Arduino IDE.

With firmware on the machine, it was time to play. Plugged into a computer, the eggbot shows up as a serial port (8N1, 115200 baud) and you can open up any terminal and type G-code at it. It echoes “ok” when it’s ready for a new command, and it appears to queue up a few commands on the “Arduino”. You’re going to need to tweak the firmware configuration in a minute or two, so you might as well get used to talking to the machine. G0 X 3.14 Y 0.50 Z 5 will move all axes in sync, lifting up the pen.

The final step is getting arbitrary artwork converted into G-code. Perhaps the easiest way is using Inkscape, which comes bundled with a “Gcodetools” extension that will do what you want. It’s what I’m using at the moment just to get things done.

But if you’re going to play around with fancier CNC machines later, you might want to investigate something like PyCAM or dxf2gcode. I enjoyed the former, but it’s way overkill for simple stuff like this. Although our own [Josh Vasquez] swears by dxf2gcode, I couldn’t get it running. Something about GUI library versions. Yuck.

Frankly, this last step in the toolchain is where I’m weakest, so if you’ve got any good CAM solutions that are aimed at simple engraving, let me know in the comments. Ideally, I want something scriptable that I can just pass an SVG file and a scaling, so that graphics to plotting is a one-liner.

You may also want a simple script to send G-code to the eggbot. Here’s the one I’ve been using. Note that controlling the eggbot is as straightforward as writing a line to the serial port and waiting for an “ok” in return to send the next.

Tweaks, Optimizations, and Where the Bodies are Buried

And you’re done! At least on paper. Working with all of the sub-parts of the project is fun, and I learned a lot even though I’ve already had tons of CNC-esque experience through DIY 3D printers. Here’s “everything else”.

Machine configuration and GRBL calibration is probably the first step. GRBL has settings ($100-$130) that define how many steps per millimeter the machine is set up to take in the physical world. Printing on eggs is strange at best. As you move north to south, the radius around the egg changes, so “x-steps per millimeter” changes as you move from top to bottom of the egg. What is constant is that with 200 steps per rotation and 16 microsteps, you have 3,200 steps per rotation. A simple choice here is to set “x-steps/mm” to 1, so that an egg is exactly 3,200 steps wide, which is easy for working with graphics — just set the image width to 3,200 pixels or millimeters.

The y-axis is another story. Eggs aren’t perfect spheres, so an angular step near the top is slightly different from that in the middle or the bottom. I printed out a bunch of squares and tweaked the “y-steps/mm” until it was about right around the equator. It’s pinched at the top and the bottom, but that’s life. Cartographers haven’t solved this problem with centuries of effort, and the earth is less egg-shaped than what comes out of a chicken anyway. I ended up with 0.7 y-steps/mm.

Compared to the defaults, I have just knocked the steps down by a factor of about 1,000. I needed to scale up the maximum speed and acceleration parameters accordingly to get the motors to move at all. Here are my configs. 20,000 steps/minute is about 6.25 RPM. How fast you want to push it depends on how grippy your egg holders are and how runny your pen is.

Now you can figure out what the total y-axis travel for your eggs are. Mine are around 1,000 pixels with this scaling. The Evil Mad Scientist standard egg seems to be 3,200 x 800 pixels. Now you know what to look for in artwork.

Speaking of egg holders… My steppers don’t have normal 6 mm flatted shafts, so I had to design egg cups myself. The standard solution for holding eggs is to use a little spring tension and the suction cups from kids’ toys. This is not optional — eggs will slip when you change directions if they’re not held in with something sticky. I couldn’t take my son’s toys apart, so I super-glued some old bike inner tube, and the rubber surface seems to grip just fine.

Getting the machine aligned right is important. The egg needs to sit in the cups so that it rotates true. Spin the axis a couple times by hand and adjust until it doesn’t wobble. Because an egg is not a sphere, you will want to lower the center of the y-axis below the center of the egg so that it traces out chords rather than circles relative to the egg, in order to minimize the difference in pen-drop from equator to top or bottom of the egg. Getting the optimal pen height here is also a matter of trial and error (but see orange Sharpie collar above) as is centering the egg north-south. A sample from our fridge suggests that you may want to tweak settings for particularly funny-shaped eggs. I know I’ll never look at a dozen the same way again!

Finally, if you’re going the Inkscape route, there are a couple things to know about Gcodetools that are hard to find out, even if you follow online tutorials. First, you (obviously?) want to be starting with “paths”. If you have an image, use “Path…Trace Bitmap” to get to paths. If you have typed letters or any other native Inkscape objects, “Path…Object to Path”. From there, using Gcodetools is a three-step operation:

  1. Select “Extensions…Gcodetools…Orientation points” and hit apply and close. This sets up the G-code origin and scale of your output by superimposing two arrows on the picture. You can move these around to locate the images. I like to put the (0,0) origin in the center of the image. Note that the default width is 1 mm / pixel. It’s not a coincidence that I chose these values for GRBL.
  2. Select “Extensions…Gcodetools…Tools library”, choose cylinder, hit apply and close. This adds a green box to the drawing, which controls some aspects of the machine speed. We’re pretending to engrave here, and a pen tip is close enough to a cylinder of 10 pixels or steps, so those defaults are OK. You will want to change the feed speed, though. This is how fast it’s going to draw. 10,000 steps / min is about right, but it’ll depend on your pen and your egg. The default of 400 is painfully slow. Edit this value with the text tool (F8).
  3. Now you’re ready for “Extensions…Gcodetools…Path to Gcode”. In the preferences tab, make sure that there’s a positive value for the “Z safe height”: 1.0 is plenty. Also note where it’s going to output the file. Then click back to the “Path to Gcode” tab (mandatory! counterintuitive!) and click apply.

Build Today, Procrastinate Tomorrow!

An eggbot is a great introduction to the world of CNC. Harder than a pure “hello world”, it’s also a ton more rewarding. You’ve got this.

Building the machine set me back maybe €25, of which only the €15 eBay order wasn’t in my well stocked closet, and took only a couple hours of human time plus ten hours of printer time and two weeks (!) of waiting. I spent much longer selecting the right firmware and looking for the right software toolchain. But much of this time was learning which is never time lost when it’s useful to other projects. Heck, that was part of the point! In the end, Project Eggbot has an exceptionally low drudgery / learning ratio, certainly when scaled by how much my family appreciates funny eggs.

With Easter 2019 just around the corner, however, the eggbot’s days are numbered. I’m still not 100% satisfied with the software side of things, but I can pull down images, convert them to paths and G-code and get them running on an egg in minutes, so good enough. I’ll take any help you’ve got in the comments. I might also swap out the servo for a third small stepper, incidentally un-doing the need for a branch of GRBL. It’s no big deal, really, but I hate the way the pen tip slams down onto the egg when it drops. A controlled landing would be much more elegant.

When Easter is over, the eggbot will fulfill its true destiny as a generic 2.5-degree-of-freedom machine. Once I’ve printed my fill of eggs, I’m unscrewing the motors and the electronics, and I’m stashing the frame in the closet until next year. Then I’m going to have to build another amusing CNC machine. I’m comfortable with the firmware, the toolchain, and the hardware after all. The rest is creativity.

So what’s next? Maybe a wall plotter bot? I love the idea of making the thing wireless, so I’m going to look into Bart Dring’s ESP32 GRBL port. Or maybe I’ll play around with the STM32 GRBL port just for fun. What’s really lacking in any of these machines is a cool, interactive, real-time controller. Maybe I need an etch-a-sketch interface to a wall plotter. Maybe with a balance board and accelerometer. What would you build?

If you think it’s too late for Easter this year, you’re probably right. But an eggbot is awesome on its own, and it’s the quickest first step into generic CNC mayhem. And that’s always in season!

Posted in cnc, cnc hacks, easter, eggbot, grbl, grbl shield, Hackaday Columns, hardware, Holiday Hacks, Interest, machine, stepper, stepper motor | Leave a comment