Being An SPI Slave Can Be Trickier Than It Appears

Interfacing with the outside world is a fairly common microcontroller task. Outside of certain use cases microcontrollers are arguably primarily useful because of how easily they can interface with other devices. If we just wanted to read and write some data we wouldn’t have gotten that Arduino! But some tasks are more common than others; for instance we’re used to being on the master side of the interface equation, not the slave side. (That’s the job for the TI engineer who designed the temperature sensor, right?) As [Pat] discovered when mocking out a missing SPI GPIO extender, sometimes playing the other role can contain unexpected difficulties.

The simple case for a SPI slave is exactly that: simple. SPI can be wonderful in its apparent simplicity. Unlike I2C there are no weird addressing schemes, read/write bits, stop and start clock conditions. You toggle a clock line and a bit of data comes out, as long as you have the right polarity schemes of course. As a slave device the basic algorithm is of commensurate complexity. Setup an interrupt on the clock pin, wait for your chip select to be asserted, and on each clock edge shift out the next bit of the current word. Check out [Pat]’s eminently readable code to see how simple it can be.

But that last little bit is where the complexity lies. When you’re the master it’s like being the apex predator, the king of the jungle, the head program manager. You dictate the tempo and everyone on the bus dances to the beat of your clock edge. Sure the datasheet for that SRAM says it can’t run faster than 8 MHz but do you really believe it? Not until you try driving that clock a little quicker to see if there’s not a speedier transfer to be had! When you’re the slave you have to have a bit ready every clock edge. Period. Missing even a single bit due to, say, an errant print statement will trash the rest of transaction in ways which are hard to detect and recover from. And your slave code needs to be able to detect those problems in order to reset for the next transaction. Getting stuck waiting to send the 8th bit of a transaction that has ended won’t do.

Check out [Pat]’s very friendly post for a nice refresher on SPI and their discoveries working through the problems of building a SPI slave. There are some helpful tips about how to keep things responsive in a device performing other tasks.

2600-Inspired Handheld Brings The Faux Woodgrain

The Atari 2600 is a console from a very different time, when home appliances, furniture, and even automobiles were all covered in fake vinyl woodgrain veneer. Somehow it was the in thing for a decade, and then immediately became tacky overnight. Regardless, if you want to evoke the era, that’s what you do – and that’s exactly what [Christian] did with this handheld RetroPie build.

An early concept sketch shows off [Christian]’s art skills.
The technical side of things is fairly routine in these parts – a Pi Zero runs RetroPie so you can play emulated games from the mid-90s and earlier. It’s the visual presentation that we particularly enjoy. The look of the early Atari is evoked through clever use of materials. The body is in black plastic, with blocky red buttons for controls. It’s finished with a vinyl woodgrain applique around the screen, and we think it’s a wonderful aesthetic.

The files to print your own are available on Thingiverse, and [Christian] has provided a basic guide to sourcing similar parts. It’s all common stuff, readily available on eBay or elsewhere.

We love seeing retro throwbacks like this – the tiny Macintosh Plus from the 2017 Superconference is a particular highlight.

Take A Mini Lathe For A Spin

[This Old Tony] is no stranger to quality tools, but he started on a mini lathe. Nostalgia does not stop him from broadcasting his usual brand of snark (actually, it is doubtful that anything short of YouTube going offline will stop that). He rates the lathe’s ability to machine different materials and lets you decide if this is an investment, or a money pit.

Lathe parts range from a chintzy start/stop button assembly that looks like it would be at home on a Power Wheels restoration project to a convenient cam locking mechanism on the tail stock which is an improvement on the lathe with which our narrator learned. We see the speed tested and promptly disproved as marketing hoopla unless you allow for a 40% margin of error. It uses a 500 watt DC motor, so don’t try correcting for mains power frequency differences. The verdict on the lead screw and thread dial is that you get what you pay for and this is demonstrated by painstakingly cutting threads into aluminum. Finally, we see torture tests on cold rolled steel.

Maybe someone from the mini lathe community will stop by with their two-cents. If you appreciate this introduction to lathes, consider [This Old Tony]’s guide to CNC machines or injection molding. But for us, [Quinn Dunki’s] series of machine tools has been a real treat this year.

Continue reading “Take A Mini Lathe For A Spin”

A Star-Trek-Inspired Robot With Raspberry Pi And AI

When [314Reactor] got a robot car kit, he knew he wanted to add some extra things to it. At about the same time he was watching a Star Trek episode that featured exocomps — robots that worked in dangerous areas. He decided to use those fictional devices to inspire his modifications to the car kit. Granted, the fictional robots were intelligent and had a replicator. So you know he won’t make an actual working replica. But then again, the ones on the TV show didn’t have all that either.

A Raspberry Pi runs Tensorflow using the standard camera.  This lets it identify objects of interest (assuming it gets them right) and sends the image back to the operator along with some identifying information. The kit already had an Arduino onboard and the new robot talks to it via a serial port. You can see a video about the project, below.

Continue reading “A Star-Trek-Inspired Robot With Raspberry Pi And AI”

From SPIDriver To I2CDriver

Communicating with microcontrollers and other embedded systems requires a communications standard. SPI is a great one, and is commonly used, but it’s not the only one available. There’s also I2C which has some advantages and disadvantages compared to SPI. The problem with both standards, however, is that modern computers don’t come with either built-in. To solve that problem and allow easier access to debugging in SPI, [James Bowman] built the SPIDriver a few months ago, and is now back by popular demand with a similar device for I2C, the I2CDriver.

Much like the SPIDriver, the I2C driver is a debugging tool that can be used at your computer with a USB interface. Working with I2C is often a hassle, with many things going on all at once that need to sync up just right in order to work at all, and this device allows the user to set up I2C devices in a fraction of the time. To start, it has a screen built in that shows information about the current device, like the signal lines and a graphical decoding of the current traffic. It also shows an address space map, and has programmable pullup resistors built in, and can send data about the I2C traffic back to its host PC for analysis.

The I2CDriver is also completely open source, from the hardware to the software, meaning you could build one from scratch if you have the will and the parts, or make changes to the code on your own to suit your specific needs. If you’re stuck using SPI still, though, you can still find the original SPIDriver tool to help you with your debugging needs with that protocol as well.

Anderson’s Water Computer Spills The Analog Secrets Of Digital Logic

One of the first things we learn about computers is the concept of binary ones and zeroes. When we dig into implementation of digital logic, we start to learn about voltages, and currents, and other realities of our analog world. It is common for textbooks to use flow of water as an analogy to explain flow of electrons, and [Glen Anderson] turned that conceptual illustration into reality. He brought his water computer to the downtown Los Angeles Mini Maker Faire this past weekend to show people the analog realities behind their digital devices.

[Glen]’s demonstration is a translation of another textbook illustration: binary adder with two four-bit inputs and a five-bit output. Each transistor is built from a plastic jewel box whose lid has been glued to the bottom to form two chambers. A ping-pong ball sits in the upper chamber, a rubber flap resides in the lower chamber covering a hole, with a string connecting them so a floating ball would lift the flap and expose the hole.

Continue reading “Anderson’s Water Computer Spills The Analog Secrets Of Digital Logic”

Energy Sipping Neodymium Sphere Keeps On Spinning

At this point we’re sure you are aware, but around these parts we don’t deduct points for projects which we can’t immediately see a practical application for. We don’t make it our business to say what is and isn’t worth your time as an individual hacker. If you got a kick out of it, great. Learned something? Even better. If you did both of those things and took the time to document it, well that’s precisely the business we’re in.

So when [Science Toolbar] sent in this project which documents the construction of an exceptionally energy efficient spinning neodymium sphere, we knew it was our kind of thing. In the documentation it’s referred to as a motor, though it doesn’t appear to have the torque to do any useful work. But still, if it can spin continuously off of the power provided by a calculator-style photovoltaic cell, it’s still a neat trick.

But how does it work? It starts by cracking open one of those little solar powered toys; the ones that wave or dance around as soon as any light hits the panel in their base. As [Science Toolbar] explains, inside these seemingly magical little gadgets is a capacitor and the classic black epoxy blob that contains an oscillator circuit. A charge is built up in the capacitor and dumped into a coil at roughly 1 Hz, which provides just enough of a push to get the mechanism going.

In the video after the break, [Science Toolbar] demonstrates how you can take those internals and pair it with a much larger coil. Rather than prompting a little sunflower or hula girl to do its thing, the coil in this version provides the motive force for getting the neodymium sphere spinning. To help things along, they’re even using a junk box zero friction magnetic bearing made up of a wood screw and a magnetized screwdriver tip.

It’s an interesting example of how a tiny charge can be built up over time, and with a nice enough enclosure this will make for a pretty cool desk toy. We’ve previously seen teardowns of similar toys, which revealed a surprising amount of complexity inside that little epoxy blob. No word on whether or not the version [Science Toolbar] cannibalized was quite so clever, however.

Continue reading “Energy Sipping Neodymium Sphere Keeps On Spinning”