Run A RepRap On An ESP8266

What can’t the little $5 WiFi module do? Now that [lhartmann] has got an ESP8266 controlling the motors of a 3D printer, that’s one more item to check off the list.

What’s coolest about this project is the way that [lhartmann] does it. The tiny ESP8266 has nowhere near the required number of GPIO pins, the primary SPI is connected to the onboard flash memory, and the secondary SPI is poorly documented and almost nobody uses it. So, [lhartmann] chose to use the I2S outputs.

I2S is most often an audio protocol, so this might at first seem like a strange choice. Although I2S sounds like I2C, it’s really essentially an SPI protocol with a fourth wire that alternates to designate the right or left channel. It’s actually just perfect for sending 16×2 bits of data at high data rates.

[lhartmann] takes these 32 bits and feeds them into four shift registers, producing 32 outputs from just the four I2S data lines. That’s more than enough signals to run the stepper motors. And since it updates at 192 kHz sample rate, it’s plenty fast enough to drive them.

The other side benefit of this technique is that it can work on single-board computers with just a little bit of software. Programming very complicated stepper movements then becomes just a matter of generating the right “audio” file and playing it out. [lhartmann] demonstrated this earlier with an Orange Pi. That’s pretty cool, too.

The code for turning the ESP8266 and a short handful of 74HC595s into a 3D printer controller are up on GitHub, so go check it out.

Thanks [CNLohr] for the tip!

What Is There To Know About Resistors?

Resistor: A passive chunk of material that resists the flow of electrical current. A terminal is connected to each end you’re done. What could be simpler?

It turns out it’s not so simple at all. Temperature, capacitance, inductance and other factors all play a part in making the resistor a rather complex component after all. Even its uses in circuits are many, but here we’ll just focus on the different types of fixed-value resistors, how they’re made, and what makes them desirable for different applications.

Let’s start with a simple one, and one of the oldest.

Continue reading “What Is There To Know About Resistors?”

New Part Day: The ESP32 Has Been Released

A few years ago, a strange little chip showed up on Seeed Studio one day. It was the ESP8266, originally sold as a serial to WiFi adapter. Since then, the microcontroller in this wee WiFi module was discovered, and the ESP8266 has been the breakout module for hundreds of Internet of Thing modules, and other wireless baubles.

The company behind the ESP8266, Espressif, wasn’t sitting on their laurels for the last few years. They’ve been working on a followup to the ESP8266. It’s the ESP32, and it’s faster, has more peripherals, better WiFi, and Bluetooth LE. Since Christmas, we’ve been ogling this chip. Now, it’s finally out. You can buy an ESP32 right now. Consider the ESP32 released.

Almost exactly two years ago, the forerunner of the ESP32 was released, allowing anyone to blink a LED from the Internet for five dollars. There was a catch with the release of the ESP8266, and that was documentation. Documentation in English did not exist, and it took Espressif a while to realize the hit they had on their hands. Even now, with a proper English datasheet from Espressif, we don’t know if the ESP8266 has 5V tolerant pins. Documentation was an issue for the ESP8266, but it didn’t really matter because someone on the Internet figured it out.

History doesn’t repeat itself, but it is the franchise with the most reboots. There’s some documentation for the ESP32, but it’s far from complete. There’s a CAN bus peripheral in the ESP32, but no one knows what pins it’s attached to. There are some secrets hidden away, but no one is at liberty to discuss them. No one outside Espressif has any idea if the specs are real. This will, of course, change in the next month or so, but only due to the tireless work of electronics enthusiasts the world over.

Right now, there are several listings on the usual online outlets including Espressif’s Taobao shop and Seeed Studio offering either bare ESP32 chips or modules based on this WiFi Bluetooth wonder. These modules include the ESP-Wroom-32 (PDF) that is seemingly based on the ESP31 test modules released late last year and the ESP3212, a module based on the popular ESP8266-12. There are also bare chips floating about.

As far as any new information regarding the ESP32 is concerned, don’t expect much. It’s released, though, and in a month or so the work of documenting this supposed wonderchip will begin.

Although they’re not available to everyone quite yet, we have two ESP-32 modules in hand, and [Elliot] is currently slogging through installing the toolchain and getting everything working. Watch this space, because we’re going to have an Introduction to the ESP-32 post up shortly.

Retrotechtacular: Home Video Recording

The news has been full of reports that the last company manufacturing consumer VCRs will cease making them this year. I think most of us are surprised that the event is only happening now. After all, these days, video recording is likely to be on a hard drive, a USB stick, or on a server somewhere. Even recording to DVDs seems a bit quaint these days.

VCR-03Back before there were web sites, people had to get information from magazines like Popular Electronics, Radio Electronics, and a few others. In the late 1960s and early 1970s, it was common to see these magazines predict that this would be the year of the home video recording system. For example, in 1971, [Lou Garner] wrote: “…they [Sony] hope will put home videotape playing in the same living room as conventional high-fidelity sound systems.” You should know that the video cassette he was talking about was 8 inches wide by 5 inches deep (a big larger than a VHS tape) and contained 3/4 inch magnetic tape (VHS used 1/2 inch tape). The 32-pound player had a retail price of about $350 (about $2,000 in today’s dollars; remember gas was $0.36 a gallon and eggs were $0.53 a dozen). It would be several years before VHS and Betamax would duke it out for home supremacy.

Continue reading “Retrotechtacular: Home Video Recording”

Software USB On The ESP8266

A while back, [cnlohr] needed a USB keyboard and mouse. His box ‘o junk didn’t hold this particular treasure, and instead of hopping on Amazon like a normal geek or venturing into the outside realm on a mid-level ‘store’ quest like a normal person, [cnlohr] decided to turn an ESP8266 into a USB keyboard and mouse. How hard could it be? The ESP doesn’t support USB, but bitbanging hasn’t stopped him before. The end result is a USB stack running on the ESP8266 WiFI module.

[cnlohr] has been working for about a month on this USB implementation for the ESP, beginning with a logic analyzer, Wireshark, Xtensa assembly, and a lot of iteration. The end result of this hardware hacking is a board based on the ESP8285 – an 8286 with integrated Flash – that fits snugly inside a USB socket.

This tiny board emulates low-speed USB (1.5 Mbps), and isn’t really fast enough for storage, serial, or any of the fancier things USB does, but it is good enough for a keyboard and mouse. Right now, [cnlohr]’s ESP USB device is hosting a webpage, and by loading this webpage on his phone, he has a virtual keyboard and mouse on a handheld touchscreen.

If you’re keeping track, [cnlohr] has now brought Ethernet and USB to a tiny microcontroller that can be bought for a few bucks through the usual online outlets. If you’d like to build your own ESP USB stick, all the files are over on the Gits.

Thanks [lageos] for the tip.

Continue reading “Software USB On The ESP8266”

Tour De Force Battery Hacking

Lithium-Ion batteries are finicky little beasts. They can’t be overcharged, overdischarged, overheated, or even looked at funny without bursting into flames. Inside any laptop battery pack, a battery charge controller keeps watch over all the little cells, and prevents them from getting damaged.

Of course, any “smart” device will sometimes make the wrong choices, and then it’s up to us to dig inside its brains and fix it. When [Viktor] got a perfectly good battery pack with a controller that refused to charge the batteries, he started off on what would become an epic journey into battery controllers, and the result is not just a fixed battery, but a controller-reprogramming tool, software, and three reversed controller chips so far.

devbBattery controller chips speak SMBus, and [Viktor] started out by building a USB-SMBus tool. It’s a clever use of a cheap eBay development board for a Cypress CY7C68013A USB microcontroller. Flashed with [Viktor]’s firmware and running his software on the host computer, a SMBus scan is child’s play.

The rest of the story is good old-fashioned hacking: looking for datasheets, reading industry powerpoints, taking wild guesses, googling for passwords, and toggling the no-connect pins while booting the controllers up. We’re not going to argue with results: the bq8030, R2J240, and M37512 controllers have all given up their secrets, and tools to program them have been integrated into [Viktor]’s SMBusb tool.

In short, this is one of the nicest hard-core hacks we’ve seen in a while. Kudos [Viktor]! And thanks for the SMBus tool.

How To Use Docker To Cross Compile For Raspberry Pi (and More)

It used to be tedious to set up a cross compile environment. Sure you can compile on the Raspberry Pi itself, but sometimes you want to use your big computer — and you can use it when your Pi is not on hand like when on an airplane with a laptop. It can be tricky to set up a cross compiler for any build tools, but if you go through one simple step, it becomes super easy regardless of what your real computer looks like. That one step is to install Docker.

Docker is available for Linux, Windows, and Mac OS. It allows developers to build images that are essentially preconfigured Linux environments that run some service. Like a virtual machine, these images can run together without interfering with each other. Unlike a virtual machine, Docker containers (the running software) are lightweight because they share the same underlying kernel and hardware of the computer.

The reality is, setting up the Raspberry Pi build environment isn’t any easier. It is just that with Docker, someone else has already done the work for you and you can automatically grab their setup and keep it up to date. If you are already running Linux, your package manager probably makes the process pretty easy too (see [Rud Merriam’s] post on that process). However, the nice thing about the images is it is a complete isolated environment that can move from machine to machine and from platform to platform (the Windows and Mac platforms use a variety of techniques to run the Linux software, but it is done transparently).

Continue reading “How To Use Docker To Cross Compile For Raspberry Pi (and More)”