Google Coral TPU dev board power up

I decided that the new machine learning fad is worth exploring. So far I’ve learned very little about it, but I acquired some cool dev kits I wanted to show off.

I got the cool Google TPU dev kit – it is branded Coral. You can read the specs here. The really cool part is that it has the new TPU ML accelerator chip. Not the first such thing to hit the market. But being from Google one would expect some very good integration with TensorFlow.

Here is how my attempt to get it to work went down: You need not one, not two, but THREE USB cables to get the beast to work.

That was rather annoying. You need a micro USB cable for serial console – fair enough and nice of them to include the USB <–> serial adapter on the board. Then you need USB-C adapter for power. Hmm maybe power the thing from the serial console cable – just a though. Ok, I understand that one may need separate cable just for power. These boards suck 2-3 amps on full load. Still could have been nice option. Then you need a third USB-C cable to flash the OS image to the board and for general data communication.

Well I was out of cables :-(. A quick search on Amazon.com revealed this item – 5 pack USB to USB-C cables. Not the most economical solution, but can’t beat the one day shipping.

Here I was today all cable connected following trough the “Get Started” guide step by step.  The setup is mostly uneventful. I won’t bore you with repeating the steps in details – they are well documented:

      • boot in the serial console and enter fastboot mode
      • download the OS image – there are two: the mendel-chef seems to be newer version
      • flash the image using the provided shell script
      • “connect to the internet” part was not needed if you have Ethernet cable. The provided steps are to enable the onboard wifi.
      • the “install Mendel Dev Tool” step was confusing – this is something you have to do on your PC/Mac not on the dev kit itself. It was not obvious to me. Then you’ll have to add the pip local folder to the path or you won’t be able to find the mystery mdt command. The path is in the little blue note in the instructions. Ultimately I skipped that step and enabled SSH instead.
      • run the ML example

I won’t lie, the example is very impressive. You run a command on the dev kit then connect to the dev kit with a browser and it simulates image recognition on a running video stream. You can type “n” in the dev kit terminal to switch between CPU and TPU and marvel at the 10x speed improvement.

A few observations: The board has a 30mm fan which is vary loud, when it runs. The fan runs when you flash the board, then when the OS boots the fan stops. There appears to be some sort of thermal management running.

To me the heatsink gets really hot. According to it’s own temperature report it gets to 60C at idle. To read the temperature from the sensor run:

cat /sys/devices/virtual/thermal/thermal_zone0/temp

It would report a number, divide by 1000 to get the temperature in Celsius. The default threshold for the fan to turn on is 65C. If you want to change it run:

echo 57000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp

You’ll need to run the above command as root. This example would turn the fan on when the sensor temperature reached 57C. There is a hysteresis of 10C by default, so the fan would turn off, when the temperature reaches 47C.

The OS itself is some offspring of Debian, called Mendel Linux. Not many details are available on it.

I would recommend changing the default password. Then enabling SSH login by editing the /etc/ssh/sshd_config file. Change PubkeyAuthentication to “yes”; uncomment the AuthorizedKeysFile line and switch PasswordAuthentication to ‘yes’. Do the PasswordAuthentication change only after you have changed the default password or you risk strangers logging in your dev kit and compromising it. You can follow this guide how to enable logging in the dev kit without requiring a password. After that you can revert the PasswordAuthentication back to ‘no’ to improve security.

You can now reduce the cable clutter, by first disconnecting the serial console and then the USB-data cable. In my case I use USB-C for power and Ethernet cable. If you want really minimalistic setup, use the onboard WiFi.

The USB-data cable is used to enable Ethernet emulation over USB. You can use it in an environment where you don’t have Ethernet or wireless network.

Google has a mystery tool called Mendel Development Tool – seems it is some sort of wrapper over ssh to allow you to log in the dev kit and copy files. I personally prefer ssh, because I’m familiar with it. The MDT tool works only over the USB-data connection.

Here is a size comparison between the Coral TPU dev board an the small NVIDIA Jetson Nano:

I don’t know much about ML to give you a reasonable comparison which is better. I would suspect both have some strengths and it really depends on the particular use case.

One small observation is that NVIDIA has established community for the Jetson products line and one can easily find answers to all sorts of questions online. By contrast the community for the Coral dev kit is not there yet.

 

TMC2660 success at last

I was very frustrated with my failure to get the TMC2660 board variation running. I checked and double checked the connections, alas the steppers would not move at all.

I purchased one TMC2660-BOB kit from digikey and started experimenting with it, instead of my board. At first, I had the same failure – the stepper would not move at all. The software was a very simple Arduino sketch – what would be that wrong. Since the kit was designed by Trinamic, the hardware should be proper. Alas, no luck. I declared the TMC2660 chip cursed and moved to my soldering machine project.

Yesterday I decided to give the test jig one more try. After a few failed attempts. I spotted an error in the Arduino code – I was passing the incorrect CS pin in the driver setup. DUH!!! After a quick fix it was working.

Then I moved back to my original goal to test the thermal dissipation ability of my TMC2660 PrntrBoard design. I connected my board and started to torture test the motor driver. Unfortunately I was not able to run the driver past 1.5A RMS, which is a shame. I’ll try using a different motor with higher coli resistance. Anyhow here is an image from my thermal camera of the top of the ship:

The chip has no heat-sink and runs at 54C. This is not bad at all. much cooler than the TMC2130 version. The board seems to be dissipating quite a bit of the energy.

Here is a picture of the bottom of the board:

The bottom is at 45C in the center, which I think is quite good thermal conductivity of the board layers.

I feel good about the board thermal capabilities. If I add heat-sinks on the top and the bottom it should be able to run at 2A RMS and above with active cooling.

Soldering machine improvements

I was very confident in my soldering machine from the tests I conducted the previous week. I decided to program a whole board and try it out.

Alas the confidence was premature and multiple failures ensued. Here is an example

I tried many things, but the soldering wire was hitting the pin and was not melting. I tried re-aligning the needle to point to the solder iron tip instead of the pin. This did not produce improvements at all. I had to aim fairly high to avoid hitting the pin and now the solder was not flowing down and bulging.

I was getting frustrated and decided to look at a few videos of commercial soldering machines for inspiration.

After a few hours I devised a new mount for the soldering needle. The previous mount was allowing adjustments only in the angle of the soldering iron as well as the needle. This configuration seems quite limited. Applying maximum effort here is the new plan:

Now the syringe is mounted on this dual clamp. The clamp allows for both items to rotate. The other end of the clamp is connected to a 3mm steel rod, which adds another degree of rotation. Finally the rod is connected to the mount plate with a plank which allows both: XY movement as well as rotation.

Here is the final assembly after a few dozen failed 3D printing jobs

The new mounting system adds quite a bit of flexibility to the position of the needle that guides the solder wire. Hopefully I’ll be able to find a location which works in most cases.

 

Soldering machine tests

I’ve been running the soldering machine for about 2 weeks. I added a very ugly, but effective fume extractor to the machine head.

It has 40mm fan and a square piece of carbon-activated filter to absorb the fumes. The design is not my best work and is held together with hot glue. However it does work.

Some early failures of the soldering were quite comical:

But some tweaks of the G-Code and it is mostly working now

At this stage it is completely manual programming. No computer vision at all. I’m recording all soldering sessions so they can be used for training ML models later.

My test board is fairly straight forward, so programming the G-Code is not hard. I use a simple C++ program to send the commands to the 3D printer controller. This allows me to add the necessary delay and in the future integrate some processing of the camera image.

I also managed to find an M12 camera lens with much less distortion, to the point that the image no longer needs corrections.

Computer vision mishaps

I was planning to add a Raspberry Pi camera on my soldering machine. I used a camera board from China which has the M12 lens mount. There is a variety of M12 lenses and one can play with the focus.

This is the camera board mounted on the soldering head

I finally got everything set up. I discovered this very nice camera streaming web interface package here is a picture of the web interface

The UI is simplistic, but allows control of the camera settings and while streaming is consumes only 3-5% CPU. Well done to the Raspberry Pi foundation and the RPi Cam Web Interface team.

Here is an image I captured with the camera

The focus looks good and the image resolution is very nice. However the vertical blue edge of the plastic mount is supposed to be straight. Not so much on the image. The 3.6mm M12 lens I used on the camera adds quite a bit of distortion around the edged. My other lenses are more on the telephoto side: 6mm, 8mm, 12mm and 16mm. I tired the 6mm lens and the distortion was better, but the field of view was too narrow and wan not capturing the soldering head. I ordered some more lenses which claim “low distortion”. We’ll see it they produce better result.

My initial goal was to capture a series of images and then “stitch” them together with OpenCV. Initial experiments failed miserably. First the lens distortion was confusing the stitching algorithm. I know that OpenCV has camera calibration option which can correct lens distortion, but I’ll try better lens first.

The other issue with the stitching was inconsistent lighting. I tried using my LED photo light, which helped initially. Still the lighting on some spots was low and some spots were too bright and getting lots of reflection from the PCB board surface.

I constructed this new camera head, which allowed me to mount a small ring of LEDs close to the camera.

I seemed like a good idea at the time, however it makes terrible reflections onto the PCB. So back to square one. I’ll make some combination of external photo light as well as some white LED strips. The goals is to have uniform light with minimal reflection and not to obstruct the movement of the machine.

Soldering machine progress

I managed to put together the chassis of the soldering machine. The bulk of it is made from parts for a Prusa MK3 3D printer. It provides a good start point so I can experiment further.

This is what is looked like in the beginning

I also put this mounting plate to hold the connectors that I need to solder for my test board. With this plate I can insert the connectors, place the board over and get it soldered quickly, then move to the next one.

Here is a video how the head would move along the Y axis

And another one along the X axis. This one needs to hop over the pins.

I used my PrntrBoard controller to drive the motors. This is a picture of the machine in it’s current variation. I added the Prusa LCD display, but have not connected it yet.

Soldering automation (attempt 1)

I was researching how to make my 3D printer controller as scale. The usual option is to make a large purchase order from a manufacturer in Asia, but why not try a different way.

The issue with ordering from a PCB assembly house is that to make the process economical you have to place an order for 100-500 boards. For smaller batches it takes too much effort for the company to setup the machines. As you can guess ordering 500 boards is not exactly an affordable affair and mistakes are very costly.

I can make PCB production fairly efficiently. The most time consuming step is soldering all through-hole connectors on the board.

So why not try to automate that? As one of my favorite superheroes often says: “Maximum effort”.

I was inspired by this video:

I liked the idea of using a dispensing needle to guide the solder wire. However I wanted a bit more control over the angle of the solder iron and the solder wire.

This is a video of my first attempt to test the soldering tip mount. I used Hakko T12 tip with a soldering iron controlled from KSGER (aliexpress).

I’m planning to mount this contraption on a Prusa MK3 chassis. The plate on the bottom is designed to mount on the X axis carrier of the Prusa.

Extruder thermal control board

For a while now I had this idea – create a small board which controls the extruder heaters and fans.

Why – you ask? Well hear my theory. I have this old printer – the RigidBot. It has dual extruder – all direct drive. However I noticed that when it starts to work my temperature readings become very noisy.

Initially I was puzzled, why the noise. After some investigation I noticed that the noise is present only after the printer motors are on. If I switch the motors off (via G-code command) the temperature line in OctoPrint becomes smooth again. It turns out the motor current is creating EMF interference with the thermisor wire.

So I was thinking instead of routing all these wires back and forth, I can build a small board with a cheap CPU that controls the temperature. I can also outsource the control of the cooling fans and even add local display etc.

All the wires needed would be power and some way to communicate between the main board and the extruder daughter board. Audio cables are relatively cheap and well shielded – I can use one for I2C or Serial communication.

In a dual extruder setup one can save quite a bit of wires: two pairs of power wires for the heaters, two pairs for the thermistors, another two pairs for the extruder fans and one or two pairs for parts cooling fans. All these could be replaced with one pair for power and an audio cable for communication – the rest of the wires are all local to the board. Well one has to mount the board somewhere close to the hotends.

Long story short, the first version of the board was not a grand success. The power supply was very noisy and the temperature readings from the ADC were so unreliable, that it was throwing the PID into a weird loop.

Here is the second installment of the board. The power is now dual stage – a buck converter to 5V and then LDO to 3.3V for the micro controller. The LDO filters the noise from the buck converter.

The brain is STM32F030 micro controller. There are 3 fan connectors with tachometer inputs, so in theory the board can alarm if the fan stops working, just like the Prusa MK3. There are 2 thermistor inputs, 2 heater MOSFETS as well as 2 thermocouple controller inputs – for MAX31855 or MAX31865 or similar.

In the next version the voltage the fans would be select-able to whatever the input is (12V or 24V) or 5V. There is a bunch of unpopulated extension pins and an LCD connector for extra fanciness.

I was testing the PID in Arduino code and it works quite well this time.

Just for fun I decided to try my thermal camera to see if there are any hot spots. The picture is with the heater 1 working.

No surprises, the heater MOSFET is a bit warm. The hottest spot is on the buck converter – 37C. Don’t be alarmed by the bright colors 37C is barely warm to the touch.

I’m still trying to figure out what should I use as software platform. Arduino is simple, but somewhat limiting. The STM32 CumeMX is another option. There is MBed and FreeRTOS options if I want to try multi tasking. Oh decisions, decisions.

~V

The TMC2660 board was a bust

I dusted off my trusty pick and place and made one of the newly received TMC2660 driver boards.

Since it’s the first time I test this setup I populated only one of the driver chips – the X axis.

Alas it was all in vain. After fighting with it for several days, the motor would not spin properly. Either my stepper driver configuration so completely busted (although I double and triple checked) or the driver chip is fried. One of the phases works, but the other sends no current to the stepper motor.

Also I was trying to fit some automotive fuses on the board – you know for protection. Alas the fuse holders I ordered are very flimsy and don’t fit the fuses at all. Ordered a different set, but have to wait.

Bummer 🙁