Fighting with computers

Computers are not always friendly.

Thursday, May 18, 2017

Lots of changes at once and one OpenSCAD bump

In order to get my new 4k display connected to my Linux box at work I had to replace the graphics card (actually I was replacing none but the motherboard's one). For the 3840x2160 resolution I selected a cheap ATI board that apparently had decent Linux support, the $100 board RX460.

First problem was my computer did show nothing on the new screen, that was fixed connecting the old one and using the BIOS to switch default video to the new card. Then Ubuntu 14.04 would boot but failed to recognize the new card, which makes sense as the driver was not install. However I would get graphics working using the software rendered (frame buffer). When looking for the Linux drivers I realized I would need to upgrade to Ubuntu 16.04, something I wanted to do for a while but kept leaving for a rainy day.

One colleague at work mentioned to me he have had quite a good experiencing upgrading a couple of systems from 14.04 to 16.04 so I was set to do it then, now that it was supposed to be easy. My experience was not as good as his, as installation complained about unsupported packages and eventually died off stating the upgrade would leave my system into an unstable state so it was cancelled.

However, after booting the system again I realized it was actually running the new version regardless of what it said before (maybe the going back to 14.04 failed too?). However I could no longer succeed with the graphical login, that would fail on me everytime. But text terminals would work ok, so I downloaded the ATI driver for my board and installed it. Next reboot I was back in business with the graphical login and now I could see the graphical interface moved smoothly and efficiently as hardware acceleration was working. I went to the graphics setup to set the scale of menu and title bars to a slighly larger size so I can read them more easily (after all, going to a larger display was done in part to view more and better the screen).

I had a couple of hickups with some leftovers of the 14.04, but eventually managed to remove the old packages and install the new ones. And it all seemed to work ok now. However I realized the OpenSCAD program cause a segmentation fault everytime I tried to start in in GUI mode. Command line operation was working though. So I assumed there was some problem maybe with my current graphics configuration. Unfortunately I was not able to find any complains of a similar problem on the web and removing an reinstalling the package did not cure it either. So I went ahead and installed a newer, nightly build, instead of the stable version and that is working flawlessly with my new hardware. I guess the cause of the fault is gone with one of the changes from the last version.

What is best is the most of the tools I have installed the last three years are already installed and printers, accounts and digital certificates do not need to be setup again. It was not an easy upgrade but it was painless than a new install and longish migration of data to the new system.

After figuring out how to send the audio through the Display Port cable, I realized the audio feature is not the most remarkable one of this 32" display by Benq, so I am keeping my old speakers that deliver richer sound.

Saturday, May 13, 2017

Wifi watching

Like train spotting, bird watching, I guess that wifi watching could become a thing, or so could be if you use this nice app for your Android phone. I avoid the term wardriving because it assumes you drive a vehicle and it has a dubious or evil aim (or may be that is only my interpretation).

I was touched by the work of these artists that visited and gave a talk at our campus a year ago. So I just went out for running an errand and grabbed nearly 900 different SSIDs around the block.

The Wifi Collector app will grab both access point information plus geographical location using the phone location services. Data can later be exported as a CSV file or KML file to be used with Google Earth as the image here shows.

While I did not uncover any political message or funny stuff on the SSIDs names on the surroundings, I guess it can be another way of catching and reviewing your walks (runs?) around the city.  I will use this app more than once just for a new way of perceiving the city that was not possible before.

Saturday, May 06, 2017

Spark on a Printrbot Simple Metal

One dry winter day I noticed a spark jumped from my finger when toughing the metal plate of a Printrbot Simple metal printer. Next time I tried to use that printer the hot-end would ram into the print bed so I had to stop the printer immediately. I remembered the spark incident and I assumed damage was done due to that static discharge.

On to find a solution. Printrbot forums showed several entries about damaged sensors and how to replace them. Others had to replace both the inductive proximity sensor plus the Printrboad control electronics too. But one thing I noticed is that my inductive sensor was apparently working, as the LED will lit when approaching a metal part to it. After testing with M119 command, I realized that as odd as it might seem, now my printer thought the signal on Z-MIN end-stop was reversed. So it was triggered when the LED was off and open when the LED was lit. That was pretty odd but as the sensor seemed to be working I set my path to modify the firmware configuration.

Once I found a suitable source code of the firmware I just changed the polarity of the ZMIN input signal and my printer was able to print again. I could not really explain why that was happening but somehow it was working so it had to be a reason for that. Anyway, the joy was short-lived and two days later the hot-end will ram into the bed at the beginning of a printing, again!

Testing the sensor again shown LED was still working as expected, but this time the M119 command will always show the sensor as opened no matter the status of the LED. After taking out the sensor output signal I would not measure any voltage change on it when detecting metal. And the ZMIN input pin was now stuck to ground so it could not longer be used as an input.

My guess is that the electrostatic damage would eventually caused the pin structure to go through a transient period of inverted polarity but eventually that pin would end up stuck to ground. And that latter phase most likely killed the sensor output driver so sensor was now busted.

Repairing all that would require a new sensor and setting the firmware to use a new input pin (or replacing the printrboard entirely).

I bought a new inductive sensor on eBay and replaced it but this time I tried if the sensor would work powered at 5V instead of the 12V it was using before, which it did. This way the sensor output could be attached directly to any free input pin of the processor. I chose PE5 signal available in ETX1 connector as the new input for ZMIN in the firmware and after uploading the new version the printer is up and running again.

I would need to be more careful in the future touching ground before touching the printer :-)

Wednesday, April 12, 2017

More on STM32

After testing different choices, I have come to test a package called Platformio that runs over Atom editor. Atom is a multiplatform code editor that looks a bit like Sublime but it is open source and they claim highly hackable.

The nice thing about PlatformIO is that it looks like a nice IDE that can handle a good portion of embedded processors from Arduino variants, to ESP8266 and ESP-32 to many ARM variants from NXP, ST, Atmel, etc.

For the f103c8t6 board I am using I can use the config details above in platformio.ini file in the project folder and it all works nicely on one of my Macs, the one using El Capitan. Unfortunately, my laptop is still running Mavericks and for that it seems there is not a libusb available that plays nicely with ST-Link programmer/debugger dongle.

Now I am going to target my dcservo code for this Cortex M3 processor.

Wednesday, April 05, 2017

STM32 or the pain I have been avoiding for quite a while

If you follow the blog you know I use Arduino IDE for quite a while and I am quite fond of the eco-
system as it usually makes things simple. With some effort, same environment works for other beefier processors like ESP8266 or even STM32.

But what usually kept me away from the various ARM offerings, with the exception of mbed on-line compiler for Nucleo boards has been the commitment level manufacturers seem to ask from engineers before they can start to think using their wonderful hardware. So far my point has been that life is to short to go through so many manuals and datasheets.

Recently, an American maker told me he was about to build a piece of hardware using a STM23F103C8T6 core to mimic my dcservo project I built around Arduino and other processors (even around a Maple Mini with a similar STM32 processor in fact). He would welcome any help on the software side of things so I had to have a look at how I could help and ventured into the wild west of development tools for these parts.

So far I have had only moderate success of loading some sample code onto a $3 board using an ST-Link USB dongle with ChibiOS's ChibiStudio IDE, but unfortunately the OpenOCD binary bundled did not work with my Windows7-32bit OS.

Yes, one of the reasons I was not keen of venturing into this world was because many of the tools are Windows-only, though many IDEs are Eclipse-based and therefore multiplatform by nature. Not so much the different debugging tools. But again, I have just stated to scratch the surface and I am trying, so far, to test only freely available tools, even if they are for Windows.

While I could compile code with ChibiStudio, I learned that CooCox IDE use a code-upload tool called CoFlash that worked for my setup and allowed me to upload code that actually worked. It was refreshing to the the USB_CDC demo working finally.

While I thought CooCox IDE was complete development solution I soon found out it was missing the compiler. I later downloaded GNU ARM compiler and I was able to build and upload (all from the IDE) a version of GRBL for STM32.  It still feels a bit of black magic and it is quite clear how many of these annoyances can prevent many users into this families of processors. Apparently you have to go the Teensy way if you are looking for a user-friendly way into the ARM world or just stay into the Arduino territory but in both cases you are a bit more limitted to the choices (and prices) of the processors available.

Now that I have a couple of IDEs working in Windows I will try to move my way to Linux to see if the same work can be done in a plaftorm of my choice. I am sure there are plenty of choices but I do not know how long it would take to test them all so any recommendation for STM32 development away from Windows is more than welcome.

Saturday, February 25, 2017

Make a heated bed with 9 calibration points.

Most likely you have learned that the new Prusa i3 from Prusa Research is including a nice self-calibration feature based on the special heated bed they use.

That bed features a grid of nine disks that can be detected by an inductive sensor that moves with the hotend carriage. These spots double as bed leveling and XY geometry calibration.

While the bed is flat an covered by a special (PEI) film to improve adhesion, the spots can be easily replicated if using an aluminium bed as my video below shows. Nine inserts of 8mm steel rod can be used by doing nine holes of the same diameter on the aluminium bed.

The interesting feature is that steel is detected further away than the surrounding aluminium so the same algorithm should work if you build your bed like this. In fact you can just place the aluminium sheet on top of your existing heated bed (though doing so may increase bed weight needlessly).

According to the calibration source code these are the locations of each point:

Click on the image to get a larger version of it (unless you have "retina" sight).

Sunday, January 15, 2017

Installing PIL on OSX

I have got some messages about installing PIL library on a Mac assuming it is a Windows-only

library. It is not.

I have never used Python Image Library before, but when I designed 4xiDraw drawing machine I used one Inkscape plug-in that was intended for laser engraving. I hacked it just a bit to make it work with my machine. The plug-in itself is a simple two-file thing you need to copy to your ~/.config/Inkscape/extensions/ but the PIL library may be a bit of a challenge on some systems.

It is important to use 0.91 version of Inkscape as the plugin will not work with an older version. Other than that it should work in Windows, OSX and Linux.

What worked for me are the following commands on an opened terminal session:

sudo easy_install pip
sudo pip install pillow