Armageddon421's Hackingblog

Archive for February, 2014

ResCan – scan resistor values!

by on Feb.15, 2014, under quickhack

Well, this one was unexpected. I went to visit ST from project-insanity and he wanted to have a huge pile of unsorted resistors… sorted. Measuring with a Multimeter is unpractical and slow and reading the color codes gets tiring very quickly.

“A machine could do this!” -me

So I started writing an android app using opencv to detect the color codes. Although the camera outputs a fullHD-Stream, it has trouble focusing at low distances. Moving the phone further away results in the color rings being only 2 pixels wide, what makes it quite hard to safely detect.

I decided to use a cheap USB-Webcam with manual focus to overcome the problem. Luckily the webcam has six cold white LEDs around the lens, providing a nice constant light source. Only the automatic adjustment of exposure time sometimes causes trouble. I used java on the desktop-PC so I could reuse parts of the code from the android app.

Although I’m using opencv to grab the video stream and its tools to crop images and draw on them, the algorithm itself is a bunch of for loops. I couldn’t bother to find out how to train any classifiers. Basically all I do is separating the resistor from the white background and then detecting the “thicker thing” between the two leads. This works pretty stable, even for extremely bent leads.

The thick red line shows where the algorithm thinks the center of the resistor is, the blue lines show where the color is grabbed. Because of the specular reflections from the LEDs, there is no grabbing happening at the center line.


Finally, I decided that it would be nice if the tool reads out the values loudly, just the way we worked in tandem when we tried to sort them manually. I used FreeTTS, an open source pure-java text to speech implementation to achieve this.

Watch the video to see it in action!

Update: I put the project on GitHub! There is also a jar to try out!

16 Comments more...

Snake on LED-Panel

by on Feb.14, 2014, under LED Panels, Projects

Hey there!

Today I want to show you a project from early 2013. Someone sold adressable LED-Stripes on the 29th Chaos Communication Congress in Hamburg and I just couldn’t resist getting me some. I bought 10 meters. The strip has 32 RGB-LEDs per meter and is made adressable by adding an IC (can’t remember the type right now) for every two LEDs. The protocol is equivalent to the WS2801, using SPI (with clock line, as opposed to the LED-integrated WS2811 which have no clock line and are pain in the a** to talk to) and therefore can easily be used directly with the raspberry pi.

Since the raspberry pi outputs a logic level of 3.3V and the LED-strip expects 5V level, some level shifting had to be done. On the 29C3 I found some nice guys giving me some SMD MosFETs, resistors and perfboard so I could fiddle together a basic level shifter. It could only handle frequencies of about 1MHz, but that was enough to make the thing shine!

The trash cans at the location had a circumference of exactly 1m, wich was ideal to just wrap the stripe around. So it happened. A USB battery pack was used to supply the thing, so it was even portable! Go party with a trash can! Unfortunately I had to leave the trash can there… This video is from the guy who sold me the stripes. Check it out!

Back at shackspace, my local hackerspace in stuttgart, I rearranged the stripes on a wooden board to make it look more like a normal LED-Panel. What game could be better on such a thing than snake? So it happened. I implemented the main thing in one night, everythin in one file. Ugly. Works. The rest of the time was spent optimizing the bot. Did I say bot? Yes I did. One weekend later I made this video showing off the result. Unfortunately it is german. Watch it.

Things like plasma effects look super smooth!

Later I added a proper level shifter, allowing stable bus clocks of up to 8MHz and much higher framerates. Next steps include prettifying, that means building a nice enclosure with milk glass and maybe cleaning up the code.

The code can be found over at github.

That’s it for now. If there are any questions… You know the drill!

Leave a Comment :, , , , , , , , more...

Android dead reckoning

by on Feb.13, 2014, under quickhack, Random

One of our lecturers gave us the excercise to to over the winter holidays to write an android app in qt that reads and logs sensor and GPS data, does some calculations on them and displays the refined result on a map.

Reading out GPS and sensors from within qt proved difficult, and displaying a map was also not exactly the easiest task at all. Two weeks before the deadline, he lifted the qt-restriction. Naturally, I started the project in android studio two days before the deadline.

In the videos below you can see the result. The data has been recorded with my smartphone placed in the center console of my car.

I found out we also had to do a height profile, so I hacked this together last-minute:

It was fun playing around with dead reckoning. If anyone is interested I might post about how it works or even try to implement some proper algorithms, since this is just a quick mockup rather than anything useful. For example there is no real calibration or gravity compensation of any kind.

This was also the first time I tried to use fragments in android, which proved quite difficult because I didn’t quite read up enough to understand how they work and how to deal with their lifecycles. I obviously managed to get it to work somehow, though, but it might not be exactly the prettiest solution.



Leave a Comment more...

Reviving The Blog

by on Feb.13, 2014, under Random

Hey there,

It’s been a long time since my last post. I must’ve kinda forgotten about this blog – or just couldn’t bother writing anything about my projects. I’m planning to revive this blog and try to make regular small updates even on small projects.

Some of the projects I’m going to post about include:

  • MLP – Massive LED Panel
  • 3D – Engine on Teensy 3
  • The smaller counterpart of the LED panel running snake
  • LED ring clock prototype
  • Android dead reckoning test
  • Playing with the neato XV-11 LIDAR
  • Quad- and Hexacopter Projects

Some of the projects I am planning to start in the future include:

  • A robot that brings me drinks! (using the LIDAR)
  • Ultrasonic Indoor Positioning System
  • Part database – catalogue all the stuff in your mess!!
  • FPV – Hexacopter

I also added a donate button in case you want to support some of the aweseome projects!

If you have any ideas or suggestions, don’t hesitate to share them in the comments.



Leave a Comment :, , , , , more...