## Connector resistance matters: the Anet A8 PCB heated bed…

My previous entry talked about the problems that I’ve been having with the Anet A8. I haven’t had the time to actually do some rework of the connector (I should get to that later today) but while I was commuting I thought about it a bit, and was trying to answer the following questions.

• How much resistance would this bad connection need to add to affect the bed heating?
• How much power was being dissipated by the PCB and at the location of the bad joint?
• Was there a significant danger of a serious meltdown?

The way I approached this was to first get some data about the heated bed. Nominally, the bed is rated for 12V at 1.2 ohms resistance. Using Ohm’s law, we know that the current is voltage divided by resistance, so the total current draw should be 10 amps, and the power is current times voltage, so the power should be 120 watts.

If you look at the bed, you’ll see it consists entirely of a very long, thin, wide PCB track which winds around the 220x220mm surface. It dissipates the power as heat, and since the resistance of the track is (very nearly) uniform, you would expect the total power to be dissipated across the entire length of the track, providing relatively uniform and modest heating.

We can model this system as a simple voltage source as 12v DC, with a series load resistance of 1.2 ohms.

If we have a bad resistive connection to the heated bed, we have some additional resistance in series with our load resistance. The total current through the bed drops because the resistance is now the sum of the connector and load resistance, which means that the total power drops. (We will imagine that the supply will continue to provide 12v regulated for this experiment.) The total power is divided between the power dissipated by the bad connector and the heated bed. A little work with Ohm’s law and voltage dividers, and you can figure out how that power splits depending on the connector resistance. I could go through the math, but it’s basic intro DC stuff. I wrote a little scrap of Python and made a graph as I varied the connector resistance
through some low values.

You can see that at even pretty small resistances, the power to the heated bed starts to drop significantly. More than that though, the power dissipated by the connector grows pretty quickly. It actually reaches its peak when its resistance matches that of the bed, where the green and blue lines cross, indicating that the power dissipated by the bed and pcb are equal, and dissipate 30 watts each.

But from a practical standpoint it is important to remember that while the 30w of the bed is spread along its entire (and substantial length) the 30w dissipated by the connector is quite small, and thus there is likely to be significant (or even catastrophic) heating at the connector. It is also important to note that as the connector resistance grows beyond this point, the power curve drops slowly, so it might continue to heat significantly over a much larger range of resistance values.

So, my math indicates that I should really be concerned about connector resistance. I think this means that I am going to avoid using a connector entirely, and solder 12 AWG wire directly to the power terminals, and carefully measure the total resistance before and after. I will also provide some additional strain relief so that as the wire flexes, it doesn’t work the joint loose.

That’s the theory. Stay tuned for the rework.

## Debugging my Anet A8 hot bed…

As in most things, whether you achieve success has a lot to do with what connections you have. And this is true of my somewhat unreliable Anet A8 3D printer more than most.

My printer had been down for a month while I worked on getting a new hot end installed properly. It wasn’t so much that it was difficult, but that it simply took time to get the new parts, find an appropriate crimping tool for the thermistor, and install the new head. Mind you, reassembling the MK8 seems to be more difficult than you would think, but I am getting better at it.

I have been thinking of doing a hot end replacement to a new Bowden extruder, so I thought that while the iron was hot (so to speak) I would print the necessary brackets so I would have them on hand when I felt like that kind of tinkering. I got the stepper motor bracket printed, and was printing the necessary bracket to mount on the X-axis when I had the print fail because of a THERMAL RUNAWAY error message. A bit of debugging revealed that there was a problem not with the hot end, but with the heated bed. In particular, it seemed like it was unable to come to temperature. The controller basically jammed the current on full blast, but it seemed to stabilize at around 38 degrees Celsius instead of the desired 50 degrees.

That was where I left it a week ago.

Finally today I decided to disassemble the hot bed and see what the issue is. My suspicion was that as with the hot end, a thermistor had failed (or perhaps just become dislodged) and was no longer reading properly. I thought I’d remove the hot bed so I could examine the underside so I could see if there was any obvious problem. To remove the hot bed, you pull the four leveling bolts at the four corners, and disconnect the connector.

Looking on the underside, you can see the connector has six pins. There are two positive, two negative and two pins which go to the thermistor. You can order replacements fairly easily, for \$13-\$20.

But back to my broken hot bed.

Like 99% of all problems, it was pretty obvious once I looked. Here is a picture of this connector:

It may not be obvious in this picture, but the left most pin (wired to positive) is pretty oxidized and gray. Looking at the corresponding socket on the plug, it also appears oxidized and gray.

Normally, the resistance of the hot bed is supposed to be around 1.2 ohms. At 12V, that means that the bed should draw 10 amps and therefore about 120w. But if the connector adds just one more ohm of resistance, it basically halves the available power, and the bed may not heat very effectively. That’s what I’m thinking of doing.

Apparently these connectors do fail fairly often because they aren’t really rated for as much current as is passing through them, and they also aren’t really designed for a connection which flexes. I think what I’m going to do is remove the connector entirely and solder the wires directly to the pins. I’ll probably have to wait until this weekend.

3DPrint Wiki on replacing the Hot Bed connector

I might also take the time to do the MOSFET upgrade that people recommend for additional safety.

## SSD1306 drivers for the ESP-IDF framework…

If I was going to port my ISS code to the ESP32 using the ESP-IDF framework, I’d need a driver for the SSD1306 OLED display.  It does seem like some people have been down this path before.  I haven’t tried any of the following, but a little quick googling revealed some promising links:

The last is perhaps most interesting, as the UG8 library is commonly used in Arduino sketches.

## The ESP32 vs. the ESP8266

Over the last year I’ve spent a small amount of money and a larger amount of time accumulating a bunch of development modules from banggood. This began mostly with me getting some spare Arduino modules cheaply. Whereas an official Arduino might cost you \$25 or so from Adafruit or Sparkfun, you can get a Geekcreit clone of the same board for about \$4 including shipping from China.

But you can import some other fun things besides Arduino.

A year and a half ago, I had received my first ESP8266 boards based upon the Arduino form factor. These would cool boards, based upon the ESP8266 wireless module from Espressif. The cool thing about these boards is that you can use the Arduino environment that you might already be familiar with to program, but the controllers themselves are significantly more powerful, and include wireless access. I have a few of these Arduino formfactor boards around, but they turned out to be less helpful than I would like, as the pin outs are moderately different and few shields are compatible. So instead, I’ve accumulated a fair number of ESP8266 boards which are based upon the format called “Wemos D1 Mini”:

The Wemos D1 Mini

I’ve been having a lot of fun with these.

But in the last year, Espressif has started shipping a new chip, the ESP32, which has a number of cool new features, but which most notably include Bluetooth Low Energy (BLE) and a dual core processor. At first, these chips were fairly hard to get, and modestly more expensive, but now the pipelines appear to be full, and the necessary software support is in a pretty good state.

And, you can get a module with an OLED module premounted for about \$11.

I’ve had these ESP32 modules lying around for a while and haven’t done much with them. I thought today that perhaps I should dust them off and port my satellite prediction code to these modules, and make a tiny little gadget which could sit on my desk and notify me (maybe even via bluetooth on my phone?) of upcoming passes of the ISS or other amateur satellites.

I had prototyped such a thing using a small OLED display on the ESP8266, and had the code lying around, including the graphic display which is the same sort that is on my ESP32 board.  Here’s a video I made of the old code.

I was hoping that it would be straightforward to port the code to the ESP32. Sadly, a few minutes of work revealed that the interface to WiFi capabilities on the ESP8266 and the ESP32 were not entirely compatible. In particular, most of the networking on the ESP8266 was being driven by a series of callbacks which aren’t implemented (as far as I can tell) on the ESP32. I also used an NTP client library on the ESP8266 which might be unsupported on the ESP32.

So, it appears that I’ll need to do a bit more digging to make this work.

I’ve also begun to ponder that if the Arduino code between the ESP8266 and the ESP32 is less easy to keep compatible, then maybe I should simply not use the Arduino framework at all, and use the lower-level ESP-IDF framework for programming. It’s not clear how hard it will be to port the necessary OLED drivers (or what support already exists) but I might give it a try.

Ultimately my goal is to implement some code for the \$11 module that wakes up, finds open or predefined Internet access, and synchronizes its time with NTP. It then contacts celestrak.com and downloads current orbital elements for the satellites I’m interested in, and then uses my satellite code to predict the position and passes of each satellite, displaying them on the tiny OLED display.

Hey, it sounds like fun. I’ll make the code available via github when I have it sorted out.

## Fun, but Frustrating: the Anet A8 3D Printer

3D printing is a big topic, and I’ve done a lot of work with this printer. There is no way for a short blog post to completely describe my experience. Consider this post the slimmest introduction about 3D printing, and a request for questions that can help others who are interested in the topic. My goal is to merely document a small part of what I’ve done for now. Expect more in the future.

For quite some time, I’ve been interested in 3D printing. At work, I had intermittent access to a Makerbot Replicator 2, but that was inconvenient and my access was shared with others, which made it even less so. I wanted a 3D printer of my own, but it was hard to justify the expense. My imagined use case was to print custom cases for various electronic projects and the like. I had used OpenSCAD to design bumper cases for the Arduino and the like, and felt that it would enable me to make more permanent versions of some projects. On the other hand, since the uses I had in mind had no real commercial or even practical value, justifying the several thousand dollar expense of a 3D printer seemed impossible.

Then, around last October, I discovered the Anet A8 kit, which was being offered for import by a number of outlets, including banggood.com which is an importer that I’ve used quite a bit for getting development boards like Arduino and ESP8266/ESP32 clones.

The Anet A8 being offered from banggood

What is amazing about this 3D printer is that it is being offered as a kit at an astonishingly low price. I paid \$165 for mine, shipped via DHL. I’ve seen prices hover up and down a bit, and seen kits go for as little as \$140. That price point was low enough, and I read enough about people’s experience that I thought I would take a risk, and pulled the trigger.

It arrived packaged neatly in a moderately sized box. I set aside a weekend for assembly, watched a bunch of videos and set to work.

First of all, here are some of the basic features of the 3D printer.

• It is based upon the proven open source design of the Prusa I3.
• The frame is constructed mostly of parts which are laser cut from acrylic plastic.
• It has a print volume of about 220x220x180 mm, which is actually pretty good.
• It has a heated bed, and can thus print either PLA or ABS plastic.
• It uses a custom controller board that speaks G-code, and can interface via USB as well as read gcode files directly from a microSD card.
• It has been pretty popular, so there are lots of reviews, tips and tricks on YouTube and on the web. Replacement parts are fairly easy and inexpensive to get online.

It took me about two days and maybe a total of ten hours to assembly. The instructions are available as a PDF file on an included microSD card, and were generally pretty good, but there were several places where I was confused, and had to consult other resources or just sit and ponder to reveal how to continue. I made a couple of mistakes that I only discovered late: a mistake in assembling the X-axis meant that it operated in reverse when I first powered it on, which was confusing until I thought very carefully about what certain diagrams meant. But in the end, I encountered no real serious problems. After 10 hours, I had a pile of parts that I thought were assembled properly.

And here is where the instructions actually get a little weak. Making your first print is actually not that well described. In particular, making sure that your printer bed is level is not all that well described, and that is an essential step in getting good quality prints. The included software on the microSD card was also for Windows, and I had (and desired) no Windows box to run it on, so I knew that I would need some additional software, and that meant developing a working configuration file for the printer.

It took me about another day of on and off pondering until I thought that I had tweaked my printer enough so that I would give it a try. I took some green “glow in the dark” PLA that I had used on the Makerbot, and tried to print one of the pre processed g-code files for a Chinese chess piece from the microSD card:

Not bad. In fact, not bad at all! I still didn’t have the bed leveling quite right. The first layer of this print was a bit uneven and high. I tweaked it, and decided to try to actually try something more challenging. The obvious to try was a Benchy which is a little toy boat which is often used as a quality benchmark. It has overhangs, smooth curves, small details, and generally is a pretty good workout for a 3D printer.

To do this, I needed to convert the STL file into a compatible G-code file. The program that came on the microSD card with the printer was an old version of Cura, and that wasn’t really going to work for me and my Linux laptop. I ended up using the open-source program slic3r, which was just an “apt-get install slic3r” command away from being installed on my Linux laptop. I used the settings for a Prusa i3, and only adjusted the bed size to match the slightly larger size of the Anet A8. I set a layer height of .2mm, the bed heat to 50 degrees C, and the filament temperature to 200 degrees C. I did not have it generate any support structures. I then clicked the “generate g code” button, saved it out, and then copied it to the microSD card, and then hoped for the best.

Here is the result:

Not bad. Not bad at all! In fact, pretty freakin’ amazing! I was ecstatic that I was getting pretty respectable results after only about three days of tinkering.

Since then, I’ve printed some more cool stuff. The most complicated thing that I’ve done to date is this dinosaur skull that I downloaded from thingiverse:

This was about 12 hours of continuous printing, using some white Solutech PLA that I bought from Fry’s Electronics. It sits on my desk at work. It’s pretty neat.

### Okay, so what’s the downside?

I was happy (and mostly remain happy) but there are a few things that have been rather problematic.

First of all, in terms of general reliability, the printer has been pretty abysmal. I had a thermistor fail in the filament heater block after a few weeks of working, and it took me a white to order replacements and get them installed. Then, after just a couple of days of use, I had a thermistor sensor fail in the heated bed. I haven’t had the chance to debug this yet, but suspect that it may be something fairly simple (like the thermistor just not making contact with the heated bed and giving unreliable readings, but I have to set aside some time to dissemble the heated bed and then relevel it, so I haven’t gotten around to it yet. And this is perhaps the most annoying thing. The printer is made from parts which are sourced from the cheapest vendor imaginable, so you might imagine that you are going to have some part failures. But the overall design of the printer is such that doing some of these replacements is inconvenient or unnecessarily complicated.

For instance, the MK8 extruder is held in place by a metal bracket that slides along the X axis. It is held by a screw which is mounted somewhat inaccessibly underneath the print head (which makes it difficult to reach or even see) and a nut which is screwed onto the heat tube and clamps the stepper motor assembly. It seems like the MK8 is just designed for maximum annoyance when assembling and disassembling. I’ve had to take it apart and reassemble it multiple times, and it seems like every time I do I am looking for at least an hour of my time. It’s impossible to make any adjustment to the head without also being forced to completely re-level the bed and generally just spend a fair amount of time tweaking stuff.

The good news is that if you’ve assembled the printer, you probably have a good idea of what all the parts are and where they should go. And the parts are inexpensive. But if your goal is to have a reliable printer that you can keep running 24/7, then the Anet A8 will not be the printer for you, at least not without significant upgrades that blunt its initial low cost.

And you will be spending more money than the initial inexpensive cost will reveal. I’ve bought a bunch of heater block/thermistor replacements. I had to buy a crimping tool and a bunch of the JST connectors you use for the thermistors because none of them can be bought “pre-crimped.” The connectors are annoyingly small and difficult to crimp, and it takes me two or three tries to get them to work. I bought some additional Kapton tape. Some spiral cable guides. A set of small metric wrenches. Some additiout sonal metric hardware in stainless steel to replace cheap adjustment screws. Some white lithium grease. A roll of good quality blue masking tape to cover the bed. I suspect I’ve added easily another \$100 to the cost.

I should also add that the design itself is not well engineered from a safety standpoint.

First of all, the entire printer is powered by a small 12V power supply which bolts to the side of the printer. To wire it up, you need to wire in a 120 volt plug (I’m in the U.S.). There is no provision for a switch or any strain relief on this cord. I got my cord from Orchard Supply and Hardware, and crimped on some spade connectors, which I then bolt in. This is what it looks like:

I do not consider this adequately safe. If someone trips over the cord, all sorts of bad things could happen, including a dead short across the freshly exposed connectors. If you intend to use this printer around children, then this part of the printer should be seriously upgraded to include a properly grounded case, fuses, and proper strain relief. As it is, I leave the printer unplugged when it is not in use, and unplug it, and carefully coil the power cable up. An upgrade to this part of the printer is clearly in my future.

The other major safety issue is that the Anet A8 board is not engineered with appropriate connectors to handle the power necessary to drive the hot end heater block and the bed heater simultaneously. While I have had no real difficulties, there are no shortage of stories on the internet about people with melted connectors like this one:

This is because the power connectors on this board are not actually properly rated for the amount of current that might be drawn through the mainboard. There are a number of ways that you can fix this shortcoming. The basic idea is to use the outputs from this board not to directly drive the bed heaters, but instead drive separate, better engineered daughter boards which use a good MOSFET and better connectors to drive the heaters. This reduces the current draw from the main board, enabling those connectors to remain cool, and shifts the power draw to the MOSFET boards which include better connectors and heatsinks. I have not yet installed those on my printers, and thus am careful not to operate the printer unattended. On long prints, I also monitor the temperature of those connectors using a non-contact infrared thermometer (yes, also bought for this product, add that to the total) and always am careful to keep a fire extinguisher handy.

In short, this is not a beginner project. If you don’t know what you are doing (or if you value your time) get a more turnkey system.

### Future posts

3D printing is a big topic. I’ve also experimented with using Octopi, which is a Linux distribution for the Raspberry Pi that you can use to make printing to your Anet A8 (or any other printer) wireless (no more schlepping microSD cards around). I’ve also goofed around with PrintRun so that I can print directly from laptop. Or I could elaborate on any of the topics that I briefly introduced above. Do you have any questions, comments or suggestions? Feel free to leave them below, or leave me a note via @brainwagon on Twitter.

## An inexpensive, open source, two factor authentication USB token: the U2F Zero

If you are like me, you have lots of accounts, and lots of passwords.   Keeping track of them all is a bit of a pain, and it’s increasingly something that you just can’t do with your brain. Several of my accounts now refuse to allow you to use a password which I consider manageable for memorization. Even if I could memorize them, you can’t reuse them for multiple accounts, so each new account places additional labor. This means that you often forget passwords, that you often have to reset them (which is a pain) and which is no real panacea for security, since if someone has access to the device or email that you receive reset notices about, they can go ahead and change them as well.

Most places are no ameliorating some of the worst problems with two factor authentication. The idea is that in addition to knowing the login password, you need to do something else, such as provide a separate time based, one time password generated by your mobile phone. Perhaps the most widely used of these is Google Authenticator which is an application that can be run on your phone. Many mobile applications such as Google Mail, Facebook, and WordPress can be configured to use Google Authenticator.

And it’s not a bad solution. In fact, it’s the solution that I used on my blog and many other applications for quite some time.

But it is kind of a pain. When you log in you have to stop what you are doing, dig out your phone, and then select the account you are interested in, and then manually copy the number from the app to your website or whatever. I began to wonder if there was some other sort of two factor authentication that would be simpler.

Recent models of the iPhone and MacBook have fingerprint scanners builtin. In many situations to verify your identity, you just press your thumb onto the pad, and voila. It’s very convenient.

But I wanted a simpler solution for use on my laptop, which doesn’t have a fingerprint scanner.

Enter the U2F Zero, a \$9 USB fob you can order from Amazon.

It is a bare bones little gadget: a naked PCB that implements the Universal 2nd Factor authentication standard. This particular one is open source and very inexpensive. You can get slightly more robust and commercially supported products from Yubico (and probably others, since it is an open standard).

The idea is that you enable U2F on a website like Facebook, which will then ask you to insert your key into a USB port and click the button. This registers this device. When you next try to login, it will ask you to reinsert your key and press the button. You don’t have to copy any numbers, just one button push and you are good to go.

I’ve only had my key for a few days, and the only application that I’ve really played with is WordPress (in fact, for the very blog that you are looking at). Here are some of my early observations:

1. U2F needs to be supported by your browser. I use Chrome on virtually every machine I have, which is well supported on all the platforms I commonly use. I’ve tested it on Linux and Mac OS.
2. To add two factor authentication to WordPress, you need to use a plugin. I used the Two Factor plugin, by George Stephanis. This adds some additional entry to the “User Profile” section of WordPress, and allows you to enable two factor authentication in a variety of ways (via email, google Authenticator, or U2F).
3. If you use U2F, then your website must use HTTPS. This was initially what spawned my switch to HTTPS several days ago, as documented here.
4. You can then register your new key for the user. I initially had some difficulty with this, and traced the problem to a permissions problem in Linux. You need to make sure that the udevfs recognizes the key appropriately. You can find the directions here on github. (The key itself shipped with no documentation.)
5. And, it works.

By no means have I done a security audit of the device. I have no real insight into how it works. It’s not clear to me how physically robust the device is, or whether it represents a significant improvement over just using Google Authenticator. I will continue to play with it for now. One of the things on my list is to implement a webserver of my own in Python that uses the U2F protocol as well. Eventually I’ll try it with other applications (github probably next) but will probably continue to use Google Authenticator for many others.

Addendum: The github page for the U2F Zero indicates that the CPU it uses is a “Universal Bee” which is made by Silicon Labs, which cost about \$1.38 in quantity one, and are optimized for low power USB applications. It has 16K of flash memory, and 2K of RAM.

## A brief review: Google WiFi

Over the last year or so, more and more of the video content that I consume is coming by way of streaming over the Internet. Very nearly every device that I have (TV, phones, Google Chromecast, Amazon Fire TV stick, and even my completely unremarkable Blu Ray player) has the ability to use WiFi and stream content from Netflix and YouTube. A little more than a year ago, we shifted from Comcast (boo!) to Sonic (yeah!) and the Dish, which also opens up some On Demand streaming.

So, it’s fair to say that we are placing a bit higher demands on our WiFi network. Sonic actually repackages ATT U-verse (DSL) in my neighborhood and gave us the usual modem/wifi access point. On paper, it wasn’t that bad a device: it had both 2.4Ghz and 5.0Ghz radios, in addition to four ethernet ports. It also serves as a VOIP server, and handles all my landline phone.

I really like Sonic, and mostly like The Dish Network, but early on, I began to be pretty dissatisfied with the quality of the WiFi network. Our modem was in an upstairs bedroom, it was clear that throughout the house, we had some dead spots where coverage was pretty mediocre. Sometimes the 2.4Ghz band seemed to penetrate better and give better performance than the 5.0Ghz band, even though the 5.0Ghz band had greater bandwidth and better theoretical performance. What was annoying was that the access point presented two different SSIDs, and if you found one better than the other, you had to manually switch. That wasn’t such a bad deal for your phone or laptop, but it was annoying with the various TV devices that didn’t store common configurations and allow you to switch between them. Additionally, my neighbors seemed to be going WiFi mad as well, judging by the number of new SSIDs that appeared in lists when I tried to connect. I wondered if they were causing contention. I could have tried to optimize the placement of my access point, or added additional repeaters, or bridge networks…

All this seemed like a lot of work. I’m not an idiot when it comes to this kind of stuff, but neither do I really want to spend a lot of time developing a complex network plan. I already have enough things that I’m not getting to: spending my time working on fixing my WiFi network seemed no more fun to me than it would be to lay new telephone and electric wires to my house. I just wanted to get something that would improve my network connectivity throughout my house, and not generate a whole lot of new “opportunities for learning.”

I spent a bit of time thinking about it, and since I had some spare bucks in my Amazon account, decided that spending some money might be in order. I thought that overall the reliability of the base network to my house was fine (a quick survey of speed tests with my laptop plugged directly into the Ethernet of the access point seemed to confirm this) but I needed a better WiFi solution.

I could pretend that I did a lot of research, but really all that I did was go on Amazon and look for highly rated solutions. I came up with Google WiFi as being a highly rated solution, which included nodes which combined to form a mesh network which promised easy configuration, better coverage and higher performance. Knowing that Amazon was very good about returns, I rolled the dice and bought it. Two days later, a box arrived at my front door.

First impressions out of the box were excellent. The quality of the packaging was very high. There were three “nodes” which are all identical in the box. Each is powered by a provided AC adapter which uses USB-C connectors. Each node also contains a pair of Ethernet ports. The box included one Ethernet cable as well. The nodes and cabling are all physically high quality.

Most routers that I’ve had before were configured using an on-device web server. The Google WiFi system takes a different approach: it requires the use of an app on either your iPhone or Android device. It I have an iPhone, so a quick download from the App Store, and I was good to go.

The first thing I did was disable the WiFi on my existing access point. I logged into the device (maybe for the last time) and disabled both the 2.4Ghz and 5.0Ghz radios. I then fired up the app on my phone, which started setup.

It was very clear and easy to follow. Basically I plugged the Ethernet cable into my existing access point and into one of the three nodes. I then powered it on. The app contacted the new node, and then asked me to scan the Q-code which is on the bottom of the device. It tried to contact the Internet… and failed. It rebooted both the access point, and the new node and… still didn’t connect to the Internet.

I then had some dim recollection that the old access point had some differentiation among the four Ethernet ports on the back. I had plugged it into the third port (it was open) but decided that maybe it should be in the first slot. I changed it, and voila! Network access achieved. It asked me for a new SSID, spent a few minutes configuring, and then it was up.

It then asked me if I wanted to install any additional nodes. I had two, so I said yes. I put one at the other end of the house, and one downstairs. It was easy, you just plug in the nodes, the app finds them, adds them to the network and configures them. It basically creates a single, bridged virtual network, all of which is accessed by a single SSID.

Once all the nodes were added, it informed me that they were doing an update to get the latest software from Google, and that it would inform me when the update is complete. It took about five and a half minutes to complete.

And… it was like the clouds opened up (or at least the tubes of the Internet did).

So. Much. Better.

There were times when I was lucky to get 1.5Mbps to my devices. Starting On Demand streaming required a couple of minutes wait, and you might expect to hit pauses while watching it because the buffering was unable to keep up with the device. The idea of streaming 4K content from netflix to my cheap (but remarkably good) \$400 Hisense television was impossible.

But not now. Every device in my house seems to be able to access at least 20Mbps, and often 30Mbps or even higher.

Dead zones? Gone. I can sit anywhere on the couch I want, and with good connections! Huzzah!

Total time to setup the network was well under 30 minutes.

I was a bit leery about relying on an app to control the network, but I must say: the app is great. It is much more responsive than the typical web based controls that most routers offer. You can check network health even when away from your home network. It lists all the active devices and access points, and can tell you of any outages. You can share network configuration privileges with others by providing their email address, which is kind of nice. You can easily configure a few of the most important settings, and can easily add port forwarding or configure IP addresses to individual devices. You can also set priorities between devices, or configure “family off times”.

If you like spending time configuring networks and firmware, and think that flashing new firmware like DDwrt or Tomato to your routers is fun (I’ve been there) then this may not be the product for you. But if you just want a network that works, with a minimum of fuss and a reasonable set of features, then I can recommend Google WiFi.

## On the allure of Quora and plans for a new brainwagon future.

You never knew what you were going to get.

Some 300 or so people a month visited my blog.  Those were the real viewers: WordPress was pretty good at getting rid of the 760,000 (and counting) attempts to inject content spam onto my blog.

But in 2015 I suffered an injury to my neck that laid me up for a few weeks with terrible back pain and arm weakness.  It recurred in 2016, even worse.  I ended up having to have two different injections in my C6/C7 vertebrae, and was in constant pain through my left arm, which became really weak.  I was out of work for 60 days.   As I sat around recovering, I discovered Quora.

It was obvious to me that Quora was a much more powerful platform than my blog ever was. I received Top Writer status for both 2016 and 2017, and they sent me a nice laptop bag to proclaim my status.

I have to say that this appealed to my ego, and as a result, it began to dig into my time that I normally would have spent on my blog, which slowed to a trickle over the last six months. It’s not that I haven’t done anything interesting and Quora is taking 100% of my time. I upgraded my soldering equipment to include a hot air rework station and a better soldering iron. I started to import lots of cool modules and stuff from China and play with them. I ordered a kit for a 3D printer and built it.

But I had stopped writing about the things that I do, and instead spent that time answering questions about stuff which mattered less to me, but which were (apparently) interesting to more people.

Over the holiday break, I began to consider where this state of affairs had led me.

Yes, it’s flattering to get comments and followers. It’s easy to add your voice in the form of opinion or indignation, and in a political environment where you feel like you need an outlet, it can be quite attractive to use easy outlets like Facebook, Twitter or Quora to vent.

But it’s not really what I want to be doing. Or at the very least, the amount of effort that I am placing in that area is out of proportion to its importance.

My blog was about stuff that I liked and stuff I was doing. It was intended to be half documentation and half inspiration. The documentation was often for me: to remind me of the stuff I had learned and might need again. The inspiration was to get others to look into the same sort of things that I like, and to come talk to me about them.

Quora doesn’t serve either of those purposes, but it is taking all of my time. So, I’m trying something new in 2018.

I’m trying to dedicate just thirty minutes of my day to do something and write about it on my blog. It doesn’t matter what it is. It might be a recommendation for a book I enjoyed. It might be projects I’m working on. It might be a review of some tech product that I found especially useful. It actually doesn’t matter what it is. It will begin with something I’m doing or thinking about, and something which I think might be worth sharing. If any of my old readers (or any new ones) find anything interesting, I’ll hope that you’ll follow my blog and comment. I’ll probably work on ways to make sure that it is as easy as possible to do so, and I might even start thinking about using a platform like YouTube to do interesting and engaging stuff. But my goal is to get back to discussing the stuff that I find fun and interesting.

I hope that you will find it so too, and come back again soon.

## brainwagon.org should now redirect to use HTTPS

I set up a plugin so that trying to access https://brainwagon.org should now automatically redirect to use https and the HTTPS protocol.   If anybody has any difficulty with pages, drop me a quick comment here, or a note via twitter (@brainwagon) and I’ll try to see what’s up.

Coming soon: my review of Google WiFi, plus my experiences with the Anet A8 3D printer.

## Happy New Year!

Well, I have decided to do a little well needed maintenance on the blog.  I installed an SSL certificate so my blog will now be available via HTTPS, and played around a bit with a U2F Zero dual factor authentication key.   My goal for the New Year is to try to spend 30 minutes every day working on my blog, which I am going to take from the entirely too much time I’ve spent on Quora.   Stay tuned for more stuff to come.

## Some new addition to the brainwagon labs…

Okay, I bet that hardly anyone comes to this blog anymore.  I’ve been slack, and there hasn’t been any reason other than the simple fact that I haven’t felt motivated to invest the time and energy to talk about any of my projects.  But that doesn’t mean that I have completely halted all attempts at doing cool (or at least “cool to me”) projects.  Over the last few months, I have:

• started teaching myself how to use Kicad
• ordered all sorts of crazy electronics modules from China
• upgraded my soldering iron to a Hakko 888 and got a hot air rework station from Sparkfun
• ordered my first boards from OSHpark
• and in the last week, assembled a 3D printer from a \$150 kit

Just as a tease, here’s my second print off my completely unoptimized 3D printer.   Not at all bad!

If any of these projects sound interesting and you’d like to hear more, why not send me a tweet (@twitter) and let me know what topics you are interested in.  I could use a little poking and prodding to increase my enthusiasm.  I still might get around to it without your questions and polite prodding, but every little bit helps.

## pinMode v. digitalWrite: what’s with this use (abuse?) of internal pullups?

This post is the kind of round about post you get first thing in the morning.   I’ll get to the title question at the end.

This morning, I was interested in doing a tiny bit of tinkering. I had found one of these 4 digit 7 segment LED displays while digging around for something else. You can get these modules for about \$2.50 from banggood, and potentially for as little as a buck on eBay.

A little over a week ago, I was tinkering with a WeMOS D1 Mini board that I had acquired, and decided to port my Plan-13 library to it. Long (long long) time readers may remember some years ago that I wrote this code to predict the position of satellites, first in Python, but then ported it to C and had it running on the Arduino as part of my ANGST (Arduino ‘n Gameduino Satellite Tracker) project. But that project had a number of shortcomings:

• It was fairly complicated, and required a number of additional add-ons to work.  I used the Gameduino to generate graphics, had an external RTC and EEPROM to store orbital data, and used an optical shaft encoder to move around.  Yes, it was attractive and fun, but not cost effective.
• It had no easy way to update orbital elements.  You had to connect it to a PC and reprogram it with new orbital elements each time you needed an update.

But these WeMOS boards are built around the ESP8266 modules, which have a number of advantages:

• They are based around an 80Mhz 32 bit processor, instead of a 16Mhz 8 bit processor.
• They have 4Mbytes of flash memory.  You can easily configure some small part of that to serve as a miniature file system, ample to store orbital elements without any additional hardware.
• They are cheap: around \$5.
• And most intriguingly: they have WiFi.

So, I worked on the spiritual descendent of ANGST.   Using the platformio system I moved a copy of my Plan13 library to a new project, and started tinkering.   As of now, the project:

• Wakes up and connects to my local WiFi network
• Establishes a connection to an NTP server, so I can get the time
• Connects to Celestrak and downloads the latest orbital elements for the ISS
• Predicts the next three passes from my home location
• And then enters a loop, predicting the sub-satellite latitude and longitude, its location relative to some major world cities, and if it is above the horizon, then the azimuth and altitude of the satellite.

Here is the current data as I write this:

But the one thing it did not have until this morning was an external display.  Hence, the TM1637, and a little tinkering.

Time is in GMT, but eventually I will also have it have the option of using local time (it is more convenient to use GMT for the satellite computations.)

To get this to work, I could have dusted off the work to drive the similar TM1640 based displays that I used in another project, but I thought that I’d use a standard library instead.   The platformio system has a pretty nifty library manager, so I searched for a library, found one (cool!) and it claimed compatibility with the ESP8266.  Neat.

So I read some of the example code, patched it to output the time in the main loop(), and tried it.

It didn’t work.

I double-checked connections.

It didn’t work.

I tried their example.

It didn’t work.  The displays remained dark.

Grumble.  I opened up the code and tried to see what was going on.   It didn’t take me too long to figure out what was going on:

Here is a link to the code, and a screen grab of the offending lines:

Link to the source on github

It’s not exactly my first rodeo, so I was immediately suspicious when I saw that the initializer set the mode for the two pins to INPUT, rather than OUTPUT, but then immediately wrote to them.  That doesn’t seem right, does it?

Well, this isn’t even my second rodeo.  I know that Arduino’s ATMega328 processor has internal pull up resistors, and I’ve seen odd code which used pinMode to swap back and forth between high and low, not using pinMode.

But the ESP8266 (thought I) doesn’t have internal pull ups.   I’m pretty sure that’s true, but I never got to verify it, because all of a sudden, with no change whatsoever, my program started working.

hate it when that happens.

It’s been that kind of a week.

But it made me think about how this works.  Here is my guess, and I’d appreciate corrections.

During initialization, it sets pinMode to INPUT, and writes a LOW value to the data pin.   Even though we’ve written a LOW, the pin is pulled HIGH by the action of the (external) pull up resistor.

When the driver wishes to shift the output pin to LOW, it uses pinMode() to shift the type for the pin to OUTPUT.   When it wants it to be high, it sets pinMode() to INPUT.

I find this odd in a couple of ways:

• It is not any shorter or more efficient than using digitalWrite.
• It is certainly no clearer.

Is there something I’m missing about why you would code this stuff this way?

Of course, I wouldn’t have dug into this code at all had I not had a mysterious (and fleeting) failure at the beginning, so I am not sure how it really matters.

Addendum:  While I was typing this, the ISS did a 65 degree elevation pass which was captured thusly.  I only then noticed that it was producing duplicate messages for each five second message.  Must have goofed when I installed the code to blink the clock’s “colon” segments.  I’ll get it sorted later.

## How making an ISS clock turns into researching an optimization problem involving spherical Voronoi diagrams…

A few years ago, I got seriously interested in amateur radio and satellites. I would often haul out a small Yagi antenna and my trusty Kenwood TH-D7A and try to talk to other hams by bouncing signals off the various satellites which acted as amateur radio repeaters. During that time, I wrote a Python version of G3RUH’s Plan-13 algorithm for predicting satellite locations. Eventually, I converted that code to C++ and made an Arduino/Gameduino version that I called “Angst”.

But there were a number of problems with it as a general project. Most notably, it utilized some special hardware which made it more expensive than I would like, and it required an external display. I suppose I could have found a small composite display, but one serious issue remained: there was no simple way to update the orbital elements that are used to predict the satellite locations. The ISS is particularly problematic, since it is in low earth orbit and frequently fires its engines to boost it to a higher orbit, which is not something that can be accounted for statically.

But in the years since I did that project, the ESP8266 has taken the world by storm. Not only is it cheap (I got some WeMos D1 Mini clones for less than \$5 shipped from China) but it is faster (an 80Mhz 32 bit processor) and most importantly includes WiFi.

For the last couple of days, I’ve been tinkering my old Plan-13 code together with some new code written especially for the ESP8266 to create a “clock” that will automatically tell me the position of the ISS and details about the next pass. The nice thing is that since the ESP8266 has WiFi, it can update itself automatically. Right now, I have code running that contacts celestrak.com, finds the latest orbital elements, predicts the next three passes, and then enters a loop where it shows the current position of the ISS every five seconds. Right now, it just echoes that information out on the serial line, but eventually I’ll get a tiny TFT or LED display to display the live information:

But just seeing the latitude and longitude of the “sub satellite” point didn’t really help me know where the satellite was in its orbit. Sure, I could (and probably will) make a little graphical display for the gadget sooner or later, but I thought it might be nice if I could have it tell me when it was passing close to certain major cities. To give this a try, I found a list of world cities and their coordinates and population, and selected the top fifty cities of the world and within the United States (make one hundred cities total) and then when I do a prediction, quickly compute the distance and bearing to each of the cities and display the closest one. And that works, and doesn’t take too much time. You can see in the run above that the closest city was Honolulu.

But, I noticed a problem.

If you imagine that the earth is a sphere, and imagine that the each city is a point on the surface which you can think of as a seed. If you collect all points on the sphere that are closest (in the great circle) sense to that point than any other seed, you end up with the globe being divided up into a number of regions, each bounded by arcs of a great circle. If you took the same computer and math classes as me, you can recognize this as a “spherical voronoi diagram”. You can read about them here where I swiped the illustration from. Here is the Voronoi diagram of the earth with seeds at each of the World Airports:

You’ll notice something: the regions are widely varying in size. If I had loaded my ISS code with these locations, it would spend a lot of time talking about how it is thousands of miles from some remote airport in the middle of the Pacific, but when it was flying over the United States, it would rapidly shift from region to region. Indeed, because population centers are often close, it might be fairly rare for it to be closest to New York City, even though it is perhaps an obvious landmark, more obvious than the smaller ones that surround it. It might also be the case that if you have two population centers which are fairly close to one another, that approaching from one side would be masked by the other city.

Ideally, we’d like a collection of cities which:

• are well known
• divide the globe into a number of Voronoi regions which are nearly the same size
• and where shape of the Voronoi regions are not too lopsided, so the cities are near the center of a roughly circular region

I haven’t figured out how to do this yet, but I’m betting that I am going to use some kind of genetic algorithm/simulated annealing approach. Stay tuned.

## Musing about a 2 dimensional delta robot…

First of all, if anyone is still swinging by this blog, yes, I’m still alive. While I haven’t exactly been prolific in my leisure activities, they haven’t stopped entirely. I worked on some simple embedded development for the hackaday.io 1K code challenge, which you can see on my hackaday.io page, and which hopefully I’ll write up here. I’ve got some additional projects in mind, so perhaps with a little extra effort on my part I’ll be getting back to more regular entries.

One of the things that has been kicking around in my head is to “make something that moves.” In particular, I’ve long been interested in gadgets like plotters, 3d printers, laser cutters and CNC machines. A few months ago on a whim, I ordered a CNC shield and Arduino so that I could begin to think about maybe creating a project which drives some steppers around to trace some pattern. I doubt that I possess the skills or know-how to do a good job of making a real CNC machine, but I kind of liked the idea of making a plotter. I started to work on the basic mechanical design of a simple 2D gantry. But frankly, I began to balk at the idea. You need two different sets of parallel ways, which seemed large and cumbersome, and each axis is different.

At the Maker Faire I had observed some simpler setups which generally go under the name of “Drawbots”. You can see an excellent write-up here on the “Death To Sharpie” page. I liked the idea a lot: it uses two steppers and the setups for each are symmetric. Each one winds and unwinds a chain, and the pen is suspended at the intersection of the two chains. In this incarnation, the pen doesn’t even have a separate control: it is simply drug around the poster board, leaving a trail wherever it goes. Pretty cool! I must admit though, I thought his software setup (laptop + Raspberry Pi + Arduino?) was a little complicated, and I’d probably enjoy working on the control software anyway.

But I was discussing this with my constant lunchtime companion Tom, discussing catenary curves and the like, and he basically said “why don’t you just use solid arms, making a 2D analog of the 3D delta robots you see in 3D printers?”

An awesome idea! One of the cool things about constructing a delta robot is that it consists of three essentially identical pillars. Yes, the three pillars all move slightly differently, but that is really a software issue, not a hardware one. A few moments of thought and I realized that you could make a pretty spiffy 2D version, and the math would actually be pretty easy.

So, in between tasks, I worked out the necessary quadratic equations, and created this gif that will demonstrate how the motion works.

The work space is the unit-size gray square at the bottom. It is bracketed by two rails, each of length two. Each has a carriage which runs along its side, and pins one end of a fixed arm (again, of unit length) which are held together in the center by a pin, which is where the pen will be. As you drive the red and green carriages back and forth, the intersection moves back and forth. It isn’t hard to see that the pen can reach any location in the unit square at the bottom.

It isn’t quite as compact as the typical drawbot, but I can’t help but think there are some serious mechanical advantages to setting up a bot this way. It should not be very hard to create an interpreter that could run on the Arduino that would take a small subset of G code and some basic scaling and rate information, and drive a pair of steppers to create this kind of a robot. I’ve never written code exactly like this before. It should be fun.

Stay tuned.