Posts

Read from multiple input devices

Image
One of the cool features of USB is that using Human Interface Device (HID) you can get a new device to behave as, for example, a keyboard. You can do this now with a Teensy or an Arduino UNO (but not the FTDI-based older Arduino boards). The key is that by using the proper USB messages a device can talk to the system in a way that looks like a mouse, a keyboard, etc. The good thing about talking like a keyboard is that applications that expect a keyboard input may be fed directly with the data from that device. This many times the case with devices like a barcode reader, that can input the scanned code to the application software as if the user was typing that number on the corresponding box of the program, which is convenient just in case the code is unreadable for any reason by the reader but not by the user (or if the barcode scanner is broken or stolen). My current project required reading RFID codes and for that I already bought a RFID reader with I2C interface that could be...

Amazon: Yes, yes, yes!

Image
When one of my kids told me his Kindle had stopped working I thought it was his fault. On closer inspection I could not see any damage to the screen. None of the suggestions of the troubleshooting guide worked so things did not look good. After some reading on Amazon forums it was clear I was not alone and other customers had experience a similar problem that required a replacement of their unit. I was very happy to learn my unit was less than a year old, so I contacted customer service to see what to do next. I had bought the unit while being in the states but I was now living in Europe, so I was uncertain about my choices. Once I explained the problem I was having with the unit, to a very nice representative named Stacey, I was told unit had to be replaced. I was told a replacement unit has been sent to my address in Europe and paid with a gift voucher. I was told that using that same box I should return the defective unit once I've got the replacement. I was even provi...

Slicing and nesting working together

Image
The initial idea was to slice 3D models into a sequence of thin slices. Once that was working it was suggested that thicker slices may reduce the total machining time. The problem is that vertical cuts for the slices will create an ugly rendering of the desired surface that will later need to be fixed by an artist. The next idea was to put together the milling action for each slice sides and the nesting algorithm that will distribute the slices into the available stock sheets. As usual it is easier to say than to do, and though it seems Aspire and Rhinoceros allow you to do a similar process, my code is now performing both tasks without user intervention. Blue or green color on the outline represent whether the slice has to be flipped or not (each slice has to be machined from top to bottom).

Hello Java Topology Suite

Image
There is always a better way, in my case, the better way was to get rid of my crappy implementation and to let others do the work for polygon buffering. And trust me, I tried to patch my simple implementation and next I tried to use the better but still not error-proof JavaGeom one. I ended up using the fine implementation of Java Topology Suite, that worked like a charm (once I managed to understand the subtle details of how things work over there).  So now you can see how the gray color lines are an accurate offset of blue polygons in my software. It did not hurt that JTS is a pure-Java library, so my tool will be multi-platform the easy way. I learned along the process that though SWIG framework does include Java bindings for CGAL library, it does not provide full access to all library functions and, once again, polygon buffer seems to be one of the parts missing. Besides, CGAL install is platform specific (though CGAL is still a terrific library). Along the process I have l...

Union of polygons

Image
I should have settled with a graphics library of some sort, but I did not. So now I have all sorts of problems some of these libraries have one function call away. Unfortunately many library creators do expect to be paid if you do a commercial product using their code. I find this to be fair, but not knowing how much or for how long just stir me away. My current problem is a simple one: I have collection of 2D polygons and I want to obtain the union of all of them. Sometimes it is a bigger polygon, sometimes a set of disconnected areas. It turns out that non-convex polygons make the solution harder than I expected. As I am writing code in Processing (Java) I could used JavaGeom , but it is based in GPC library . I could use JTS library , but I was lost in the process of learning how to integrate it with my code, but this was before I learned the problem took me longer to get it coded than learning another library. You have been warned! Update: If you can settle with int...

Another week, another problem

Image
The project I am working on at the moment requires solving several computer graphics problems. I mentioned a while ago the polygon offsetting problem. Today my problem is about placing polygons on pages to be printed. I want to make the listing as short as possible, thereby packing the polygons in fewer pages is desired. Trying not to reinvent the wheel I googled around first. Of course the first problem of the googling thing is to figure out what is the popular name of the problem you are interested on (and believe me, I am yet to find an "original" problem never thought and wrote about it before). My first searches suggested Cutting stock problem , but  it was not exactly my case. It is a pity as in 2007 a dynamic programming solution was published . So moving on I found the best fit to be the Bin packing problem .  Again, an NP hard problem. Wikipedia article suggested the heuristic of the first fit algorithm , that is known to provide good (but not optimal) solution...

Mending my mistakes

Image
While I am not a king (inside joke for Spaniards only) I do make mistakes quite often. One of them was not to disconnect my RAMPS-controlled 3D printer from the computer and mains supply for a quick solder job (just one pin of heating resistor was loose just before starting a print ...). Unfortunately, my trustry JBC solder of the last twenty years was not properly isolated anymore and I had a big flash and all the house lights went down. When I restored the power the computer was booting up happily, the printer power supply light was on but the printer was dead and the computer was unable to detect the printer anymore. All the lights on the board and on the Arduino Mega were off too and my system shown a warning message that USB port was disconnected for excessive power consumption: no good news at all, but at least I learned the USB port was not completely dead. I removed the RAMPS board from the Arduino Mega, connected it to the USB cable and then the lights come back on, su...

Of polygon offsetting

Image
Last week I have been researching about a task I initially did not even know the name: Polygon offsetting. A polygon offset (in case you ignored it too) is a computer graphics primitive (though it can be done by hand too) that given a polygon will trace a inner or outer version of it that it is either totally contained inside the polygon or that it will contain it entirely (if you want an outer offset) whose perimeter will be at a constant distance from the perimeter of the initial polygon. And given that I seriously doubt that my explanation is good enough, here you have an image (of an inner offset, gray-line perimeter): I was looking for an available implementation of this process, as I wanted to be able to use it for an ongoing project. This time Google did not helped much and though I was able to find the question I borrowed the picture above from and that CGAL library did have polygon offset as one of the functions or that there was Clipper library or a Python implement...

The not so intuitive use of an IMU

Image
A recent project required acceleration measurements to study a person's gait. I thought this could be done easily with one of the many MEMS (MicroElectroMechanical Systems) devices available in the market under the name of IMU (Intertial Measurement Units) or just accelerometers. I settled with the cheapest acceloremeter I found on eBay with an I2C interface to connect it to a Funnel IO powered by a rechargeable Lithium battery. Funnel IO (or FIO in short) is an Arduino-like board that includes a USB-powered battery charger plus an XBee module interface on board. It can be programmed wirelessly but this proved to be a real PITA to get it working (and even after that, it does not work reliably). Once I got some code grabbed from Arduino forums to read my sensor (MMA7660FC from Freescale) I was a bit shocked with the results. My sensor was a 3-axis accelerometer and  I was expecting a measurement of X=Y=Z=0 on my first test with the sensor static. I was wrong. I shoul...

Wireless 3D printing

Image
Last week I had a "USB cable incident" with my Prusa (computer and printers are on different tables in my office). It was entirely my fault as I walked across the USB cable and I almost threw my printer to the floor. As a result, the ferrite torus I put in the USB cable to prevent EMI problems broke. Without it, I know prints may interrupt anytime due to interference. While on eBay looking for a replacement, I realized that a Bluetooth module was costing less than $15 now. So I thought I could give it a chance to the idea of operating my printers wirelessly.   Later, I learned of an even cheaper module at $6.60 , but this one is 3.3v only (which is ok if you are using this voltage for your Arduino, but I am using 5v). A quick look at Sprinter firmware and Arduino Mega and RAMPS board specs revealed that Serial2 port using 16 (TX) and 17 (RX) pins was easily available on the ext4 connector of RAMPS board. And so was GND and +5V. Making it very easy to connect the Bluetoot...

Arduino RFID

Image
This time I am interested on a particular application of this technology: My university has moved to RFID picture IDs for students and I was curious about how difficult it was to read the cards from an Arduino board. Our system is using 13.56 MHz cards, so I ventured into eBay territory. Almost anyone can type "Arduino RFID" there to get plenty of cards that allow you to read (and write) RFID tags/cards. For those of you living in a cave, RFID is a wireless technology that allows you to both power and interact wirelessly with a card or tag that contains a digital unique identifier that optionally may include some rewritable memory too. Tags or cards themselves do not have nor need a battery but they contain a microchip and a coil to gather energy from nearby readers. That means that the card and the reader need to be pretty close for this to work (that is why the technology is dubbed as NFC or Near Field Communication). After buying one card and waiting the usual two w...

Would you print me this equation?

Image
I had a visit this week of a teacher interested on creating 3D prints out of equations. The thing is that most of the tools I used need to have a polygonal mesh in the form of an STL file in order to print an object. I have found a couple of interesting tools. On one hand, Wolfram Alpha allows you to download any generated volume out of your equation, but you need to have PRO account. It seems you can have free PRO account for a couple of weeks, but later you have to pay a monthly fee. I did not explore that route any further. The other is a piece of software called K3DSurf that does the job for free. It is interesting though it did not work in my Mac, not even after installing Qt3, but it worked in Windows XP. It is worth a try!

Misleading HP marketing

Image
Not one but two friends brought to my attention the apparently innovative new product by HP touted as a 3D scanner and printer  HP TopShot LaserJet Pro M275 . I was surprised by the marketing information and curious to see what this device was capable of. If you've followed my blog, you've read about my late interest on 3D scanning and printing, so a 3D scanner that was being made by the biggest printer maker seemed like a big deal and maybe the signal of new devices to come. However, after cutting through the marketing campaign, I was able to read some of the details of what the device can really do . That was the disappointing end of the history: what HP Topshot technology is about is not 3D scanning but to take pictures of objects. Do I really need to say that of course the objects you can take pictures from can be 3D objects? Are not all the objects we use 3D? Ok, maybe you can claim that paper pages are not 3D (we can argue on the scale of it). But to me, HP mar...

Online slicing with Autodesk

Image
I mentioned a while ago the cool software by Autodesk 123D Make that enable those with access to a laser cutter to create 3D objects from cardboard slices. The problem was that the software was only available for Apple computers. Now there is an online version that does the job no matter what operating system you use. The image shows a cardboard version of my happy new year design you can get on Thingiverse.com Update: A big oops if you use Linux ... (I do).

Testing PCL 2.0 Kinfu_app

Image
I borrowed another graphics card from a friend and this time it was the right one: Nvidia GTX 560 Ti with 1GB of RAM so I was able to test drive the new open implementation of the Kinect Fusion. First result is really promising. A couple of times I've got out of memory errors when starting the application but it was unclear to me whether it was main system RAM or the graphics' card internal memory. Pressing 3 you get the current point cloud written to disk. I am really shocked by the accuracy of the real-time results. I am getting around 20 fps. Definitely worth trying, but remember you'll need a powerful power supply too. I borrowed a 1.000 watts PC supply, sweet.

Testing Kinfu (or not)

Image
Once I realized all the work done for compiling PCL 2.0 was useless with my current graphics card I mentioned to a colleague the problem who was kind enough to lend me a Nvidia FX 5800 CUDA-enabled graphics card with 4 GB of RAM. I thought it was beyond the requirements of Kinfu so I did not bother checking it out before doing the installation. First problem was that this card hardly fit inside my computer. Later I found out my power supply just lacked the proper connectors to power that graphics card. I asked for help and I have got a 1000W PC power supply. This one has all the connectors needed but I am not fitting it inside my computer box. Once I was convinced of the right way of connecting the 8 pin PCI-express additional power socket, which was all but obvious to me, I fired up the system and it came up nicely. But, once again, I was defeated by the hardware: It turns out this board is not a good match for running Kinfu either. Though it has 250 cores, it lacks the computin...

Kinect Fusion open sourced!!

Image
I was impressed when I saw the results presented in SIGGRAPH'11 about Kinect Fusion by a group of people from Microsoft Research. They manage to get a fantastic real-time scene scene registering using a software they named Kinect Fusion. A couple of papers were published explaining the system architecture and some videos shown the great performance they were obtaining. Today I have learned that an open source version is being built around the Point Cloud Library and the sample video looks equally promising. But development is only going to be supported on the upcoming 2.0 version of the library. I am going go give it a try as soon as I manage to compile the whole thing .   Ouch: After fighting with CUDA install (driver, tools, sdk) plus VTK library that was not installed plus some more fiddling with cmake and ccmake I manged to compile the current version of PCL2.0 but to no avail, as kingfu_app is not happy with my oldish video card (GF8400GS) and I get this lovely mess...

Software for 3D scanning using Kinect

Nicolas Burrus ' company has been kind enough to make available software for 3D scanning using a Kinect device that anyone can use for both Windows and OSX. What you obtain is a colored point cloud and not a mesh, but using software like meshlab you can turn that into triangular mesh. The way you use this software is by handholding your Kinect and moving it around the object or room you want to scan as if you were painting all the space. The point cloud is growing larger every time you move to a different area of the scene or object. Result is not as impressive as Kinect Fusion demos but, contrary to the former, this one is available. I guess the will keep on improving the system to obtain better spatial resolution with less noise.

Direct drive extruder

Image
Once I have got my Prusa Mendel 3D printer working, I have started to look around for improvements. The thing I was less happy with was the clunky extruder , made of a geared drive with printed gears. People in the forums mention it has a limited life of maybe one hundred hours before one or more teeth give in. I thought a direct drive was an obvious choice only if extruder stepper might have enough torque. Then I learned that Orca v0.3 is using a direct drive using a brass insert . I looked for available designs on the Thingiverse for NEMA 17 motors and I have found this one . With some changes I have made it work. But not before I replaced one StepStick by a Pololu stepper driver on my RAMPS board. The reason is that to achieve the required torque, the motor needs to be driven slightly above the 1A limit of StepSticks. The other required change is to add some cooler to the A4988 chip so it can properly dissipate the additional heat. I guess 3mm filament i...

Arts exhibit

Image
I've been quite busy lately so I've not been posting news but doing new stuff. A few weeks ago a new exhibit it the City Museum of Valencia by local artist Rubén Tortosa stated and one of the pieces was this one, which I designed and programmed. It is an interactive installation that grabs the visitor silhouette and then it draws it onto the wall at a random location. Drawing accuracy is not intended (or so I was told by the artist). We went for a very simple design, based on my vertical plotter , and a Kinect device was used to gather the images. You can see below a sample of some the drawings of the very first days of the exhibit. The exhibit will be open till the end of this year and there is no entrance fee. Together with the installation there is a set of interesting pictures I have nothing to do with. Update: Wow, we're on the Arduino blog now. Arduino code is quite unremarkable as we use a couple of Pololu motor controllers driving the stepper motors....