Posts

Showing posts from 2020

Processing 3.5 on the RPi4 (with OpenCV and Kinect support)

Image
Ten years ago I created with my friend RubĂ©n Tortosa an art installation that would use a Kinect to capture the silhouette of a person standing in front of it. At the time, it was a PC running Ubuntu 10.10 and using Microsoft's Kinect camera. Microsoft wanted all of us to only use that camera with the Xbox game system. Thanks to the libfreenect library many of us did exactly the opposite.  That piece has gone through several exhibits and it is now starting to cough up every now and then. So I wanted to check if the new Raspberry Pi 4 was a possible candidate for replacing the PC.  I installed the 32-bit Jesse distro on a 16GB SD card and placed into my RPi4. I was able to install Processing on the Pi with this command-line:  curl https://processing.org/download/install-arm.sh | sudo sh The next step was to be able to use it, but as I was running a headless system, I could not rely on the local display. I am using Xvnc instead, so now I have a "virtual" screen I can acce

The long and winding road of Raspberry Pi 4

Image
 A new project requires a Raspberry 4. It should be easy to get it working, I thought. But as the devil is in the details, my morning bumped into several major showstoppers: It turns out the new RPi4 comes with a micro-HDMI. That, of course, is not hidden information but something I should have paid attention to in advance, but I did not. So it was now when I realize it was not possible to use any display for the initial configuration of the board or for any of my tests.  I remembered that RPi's had a serial connection over the GPIO bus I could attach to. But it turns out that feature is now disabled by default on versions 3 and 4 of the RPi, as they use that hardware serial port for Bluetooth communications. It is possible to get it back with the enable_uart=1  line on /boot/config.txt Unfortunately, the brand new SD card I have got with the RPi4 did not work. I am not sure is was defective or whether it was damaged when trying to get it out from its packaging (Intenso brand in c

Prusa SL1 SLA 3D printer build and first impressions

Image
 I ordered this printer almost a year ago, but then the MINI appeared and I decided to get a MINI too, so my new order was delayed due to the MINI massive backlog. It was delivered last March, just at the beginning of the pandemic, so I thought I would have plenty of time to devote to it. But I was wrong and it has been sitting inside the box in our home's hall for several months.  To be honest, I knew the resin will be smelly so I was not eager to build this printer unless I had a use for it. That and the almost unavailable Isopropilic Alcohol (IPA) that was needed kept the project on hold. But given I finally got a good deal for IPA on Amazon something needed to be done. So last Saturday morning I started unpacking the several layers of foam with parts and went ahead building the Prusa SL1 printer. I would say it was simpler than the MK3, with lots of folded metal and machined aluminum parts and just a few 3D printed parts. Lots of screws and a good number of active parts and ele

Road-trip time-lapse

Image
 A while ago I bought my second action camera, this time I made sure it could do a time-lapse video (something the first one I bought was not capable of). Anyway, the camera sat on a shelf for more than a year. But during the summer holidays, I was doing a trip and I thought it would be cool to create a  hyper-lapse of my drive. As usual, things went wrong when I was about to fix the camera to my car's windshield: it was not possible to fix it properly oriented, so the camera did the recording upside-down. I was not sure I could easily rotate the recording but I was positive I could rotate images so I decided to record the time-lapse as a sequence of JPG pictures. I checked there was enough memory available on the SD card and I connected the USB cable from the camera to one of the car's USB power sockets.  I stated the recoding and drove away. I could see the camera was doing its job and then I entirely forgot about it until we arrived at our destination four hours later. Once

Fan blades replacement

Image
I have two fans at home, one of them is quieter than the other. I assumed the reason was the shape and number of the blades, as the noisier one features a 3-blade rotor while the quieter one is a 5-blade one.  A good design exercise that might bring some real-life benefit if proved successful. So I went on and created a model using Onshape, that had to be able to be printed in the Prusa MINI. I designed two parts , the hub, and the blade, that will join with a dovetail.  While I did not do an exact copy of the quieter fan blades, I tried to stay as similar as possible. Which may not be good enough for the best results. It was also a project to explore the viability of the 3D printed approach. So this is what I designed:  To my amazement, 3D printing the blades really favored printing them all together, as the print time of each layer was so small if printing just one that the print needed to be slowed down. So printing five blades did only required around 3 times the print time of prin

First steps with a Duet 2 Wifi

Image
I have been testing a Duet 2 Wifi board lately. It is the first 3D printer / CNC controller board that I use that has a decent wireless upload speed. It is a well-thought-out board designed by David Crocker and Tony Lock, that features both an ARM ATSAM4E8E and ESP8266 module. The former handles the RepRapFirmware and the latter provides wireless connectivity to the mix.  The board features five silent stepper motor drivers and heaters and fan controllers to be used on 3D printers or CNC machines. The built-in socket for an SD card allows its usage not only to hold the firmware and website files but also user folders containing g-code files that can be uploaded and managed remotely through the built-in web server.  The only main problem for the newbie is SD card and board initialization, which should have been taken care of by the seller unless they are lousy. But the board I got did have an empty SD and no manual so I had to go Duet3.com site to get some answers in their Documentatio

Remote shutdown your Python program

Image
One piece of code for a project is written in Python and it does what it was intended to do but, out of the blue, I am asked about the possibility of shutting it down remotely from another computer (code is running on a server where I do not want other users to be messing around). It was a perfect opportunity for using the threading library. So I went ahead and I wrote a small piece of code, encapsulated in a function, that will be run on a different thread. The main program is still doing its thing, but the new thread now creates a network socket and binds it to the proper IP address and port so it can accept connections from other computers over the network. When a new connection is made, the code will check if a special token is received, and if that is confirmed, it will shut down the whole program. Otherwise, the thread will loop forever in case new connections are made in the future. So the question is how to shut down the program. Usually, I use exit(0) to make my program

Uploading code wirelessly to Arduino Mega

Image
Given the same thing worked ok using an Arduino UNO form-factor board with both an AVR 328p and an ESP8266, I was expecting not much trouble getting the same thing to work for a similar board in the Arduino Mega format. Oh boy, I was wrong! The hardware modification part was easy: Find the diode whose cathode is connected to the RESET pin and remove it from the board. ( Board schematic ) I used GPIO12 as the ESP8266 pin to be used to reset the AVR processor (key for a remote upload). But once the hardware was working, it became obvious the software side of things was just not working. I could see no communication was ever successful between the ATMega2560 and avrdude program. Reset generation was not a problem as it was clear remote reset was working ok. Perhaps timing? Let us read about possible issues on github. It turns out this is old news, as ESP-Link is playing a trick to detect the attempt of a firmware upload so it can reset the AVR chip then. That detection was

Uploading code to your Arduino board remotely

Image
A while ago I bought some Arduino UNO and Mega cards that featured, besides the usual processor, an on-board ESP8266 processor to bring Wi-Fi connectivity to them. These boards , have DIP switches to be able to program either the AVR (Arduino) processor or the ESP8266 using the USB port (think of them as a sort of serial port multiplexer). The main use for me was to be able to use them for different applications without using a USB cable. A [Wi-Fi]  TCP connection to port 23 would be used instead. As I am using ESP-Link firmware for the ESP8266. Do you want to print wirelessly on your 3D printer? You can do that with one of these Arduino Mega boards that can use Marlin. Using Pronterface software you can print to a TCP socket the same as if you print to a serial port. However, what intrigued me is that no mention was made in the boards I use about using the ESP8266 to upload new programs to the Arduino processor. And that was odd as ESP-Link software allows you to do that. Howev

Plot real-time data with Python

Image
I am involved in a project to create a tensile tester for a friend. I have never used a tensile tester myself so I have to play by ear here. But it occurred to me that not much more than a strong 1-dimensional axis would be needed. So we built a mock-up using a stepper motor, some old guides from a sliding door and threaded rod connected to both the motor shaft and a nut that was soldered to the moving carriage. The second part of the contraption was to set a load cell on one end so a test piece could be fixed between the load cell and the moving carriage. As the carriage pulls away from the load cell, the specimen response could be measured and graphed. Using an Arduino was the obvious choice this time, as it was, in fact, the only choice, given my friend is building this thing at home, three thousand miles away from me and we all are under covid19 lockdown. He only had one Arduino Mega at home, so that is what we will use. I thought that specimen test data could just be sent to

First impressions on Prusa MINI

Image
Although I bought the unit back in October 2019, it seems I was not the only one, so it has been a while until I have received my unit, but just last week, during the lockdown, I was pleased my new printer arrived. The main goal was for this printer to be a tiny 3D printer to have on my desk at home. I have been very pleased with Prusa's MK3 printer that provided me with reliable prints every time I need it. I just thought a smaller printer would be ok at home, as most of the time I do not need the extra volume the MK3 can do. Building the Prusa MINI was quite straightforward and it took me less than one hour. I guess it can be done much faster once you are familiar with the model. The new LCD graphic color display is one step forward from the older LCD used in the MK3. It is kind of small so I did not miss it was not touch-sensitive. Once it was built and working, I checked the firmware version and it was, indeed, running the latest version.  So the next step was to prin

Improving your streaming game

Image
After my first on-line lecture I have got some interesting feedback from my students and from my own experience too. While it felt odd during the first few minutes, the fact I saw many of my students were there and that setup mostly worked made me relax a bit more during the second half of the class. But, first of all, let me tell you what worked well and what did not: Asking the students to post a comment for attendance record worked extremely well in my opinion. As it allowed me to put faces to the online viewers counter, while it also reassured me my students were ready, which also relaxed me as I was worried they might not show up. Comments allowed students to report audio trouble when it happened and me fixing it quickly.  Of course, comments also allowed students to raise questions about the topics I was talking about, which make the lecture a bit more interactive and, hopefully, useful and entertaining. I found myself at times uneasy as I have not a pointer to signal on

Youtube streaming for dummies (and for me too)

Image
The coronavirus crisis forced us all to stay home. Those of us in the education business are instructed to keep going using online resources. But given the current state of laws, I am reluctant to distribute any personal information (and that includes emails) to any available webinar platform. Several of them have been suggested like GoToMeeting or Zoom by my friends. We have Microsoft's Teams on-campus package but, for some reason not all my students are on the platform. So it appears the simplest thing to do is to just use youtube streaming service, that allows hidden videos/streams, only accessible to those who know the URL. And I could email the stream info to my students by email without revealing their email information to anyone. So that sounds like a plan but ... there are a few caveats: While I do know how to stream a video out of a webcam (as simple as pressing the upload button and choosing "Go live"), just the idea of a talking head does not seem very a

The interesting world of VAWTs

Image
I was curious about the type of wind turbines that do not need to face into the wind. So I googled around to learn they are called Vertical Axis Wind Turbines (or VAWTs). But that is not all there is to it. There are a handful of different designs built around two basic concepts: drag and lift. And as you can guess, these are not as efficient as the more popular Horizontal Axis Wind Turbines (HAWTs) found on most wind farms. The beauty of the VAWT is their simplicity: Just a special shape the wind will rotate and, if connected to a generator, it could be used to produce energy too. But its power-generation capability is somehow smaller (if you consider the frontal area it presents to the wind) than the propeller rotors of the HAWTs. On the other hand, some of the designs, have been created quite simple so they can be built repurposing other objects. For example, the basic Savonius rotor can be built by joining two halves of an oil barrel in an S-shape configuration. Any other c

Spot welder

Image
Over the years I have seen a few ways of doing spot welder for battery packs: A bank of electrolytic capacitors One or more super-capacitors A modified microwave oven transformer A car or motorbike or LiPo battery But besides the power source, some sort of control is needed, as you are basically shorting the output of your power source and you do not want that to last long. The simplest thing to do is to use a pushbutton, but that is not very precise nor repeatable, so something like an electronic timer can work best. But if you want to provide more than a single pulse a microcontroller can be the best choice for a precise and repeatable switching of the power. And switching the power can be another source of trouble, especially if the switch is the high-current side. A spot welder can rush hundreds of Amperes and you need something more than a pushbutton to handle that. Some designs use a bank of MOSFET transistors to do the job (power dissipation is not huge due to th