January 1st, 2014 by Chris Elwood
I've recently been working on moving from AVR to STM32 microcontrollers for most of my projects. While AVRs were great to learn on, they aren't the best value compared to the other options available now. For the price you can generally get a a STM32 chip with more power and better peripherals.
So far I have mostly worked with the STM32 Discovery boards because they are cheap and include the programmer. But they are somewhat large and not breadboard friendly. What I really wanted was something simple to replace an Arduino as the "standard" board I use to test out new ideas.
Here is what I ended up with:
There is not much to it beyond the basic components needed to get things running. This is partly because I am new to board design and wanted to keep it simple. But it is also all I really need to replace an Arduino in most projects. Total cost to build one is under $10 even in small quantities.
Programming using the built-in programmer on a discovery board.
Here are the eagle files.
May 3rd, 2013 by Chris Elwood
Some time in the last year my VX-6R radio started having problems receiving. On narrowband FM mode it had trouble picking anything up at all. The local weather radio station, which came in loud and clear on another radio, could barely be heard. I did some searching around and found this forum thread which described exactly the same problem. Then, while looking for the replacement part mentioned there, I found a description of the same fix here.
Conveniently, the second page above was written by Tim (WO9U), who is part of the amateur radio club at my school. I asked him about it and found out that he even had a spare of the replacement part! So today I opened up the radio and took care of it. The details are better explained in the links above, but basically it came down to replacing a filter that had failed. Tim was kind enough to not only provide the replacement part, but to bring his soldering equipment for me to use and to help with the actual repair. Having someone experienced watching certainly helped with the nervousness of taking a soldering iron to a relatively expensive radio!
After removing bad filter. (empty box above the yellow connector)
The only difficult part was removing the old filter, which took almost an hour. It should have been easier, but the soldering iron used was not meant for lead free solder and probably was not as hot as would be ideal for this.
New filter in place and ready to go back into the radio.
The replacement seems to have completely fixed the problem! Full signal strength on the weather radio station again and background noise is back to a normal level.
April 21st, 2013 by Chris Elwood
So I think it is finally time to start updating this blog. On April 1st xkcd posted a comic titled "Externalities", which partly involved a competition to find a value that matches the most bits in a given Skein 1024 hash. I decided to write a program to automate the guessing process and see how well I could do.
With a good cryptographic hash like Skein there should be no way to predict the input used to generate a given hash. This means that the best strategy is to simply to compute as many random hashes as possible. I originally wrote a simple C# program using the SkeinFish library. It performed reasonably well at about 100,000 hashes per second, but was limited by the fact that it was single threaded and that the SkeinFish library was not the fastest. Running this for a few hours did produce a reasonable result of 411 bits different.
After a while I decided to rewrite the program properly, using an optimized Skein implementation and multithreading. The best option looked to be the Skein3Fish library in C. This was new territory for me, as all of my C experience had been on Arduino and other microcontrollers. Best way to learn is by doing!
The basic structure of the program is this: Each thread has a counter to generate input data to Skein (given how the hash works, there is no need to generate random input or anything... as far as I understand at least). A starting counter value is input when the program is started and each thread starts at this value plus a per-thread offset. The current counter value is mapped to ASCII characters and used to calculate a hash. Each thread keeps a “best” value. When a thread finds a better result, it takes a lock on the main thread and checks if its value beats the global best value. It updates the global value if it does, or updates its own best value if not. This prevents the threads from having to lock the main thread often.
I made some effort to optimize the code, although I'm sure there is still room for improvement. The worker threads only report status every ~1M hashes, the comparison of matching bits is done with the method described at http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetTable, and the code for converting the counter value to ASCII character is made as simple as possible. On a dual core i5 processor it reached almost 5 million hashes per second. A pretty nice improvement over the first version! Both myself and a friend ran the program overnight, completing about 300 billion hashes total and getting a best of 402 bits difference. Well behind the leaders but still decent in my opinion.
The source code is available here. The directory structure is somewhat messy due to starting from one of the Skein3Fish example programs, but it should be fairly easy to build using cmake. Given that it was my first serious C program and was not thoroughly tested there may still be some bugs. Feel free to let me know if you find anything, but with the competition being long over I am not planning to work on it any further myself.
December 27th, 2011 by Chris Elwood
I created this site to document some of my projects. I hope you find them interesting.
This site itself is actually one of those projects... it is powered by some basic blog/CMS software that I wrote in PHP. I am planning to add comments and a few other features eventually, but it may be a while. For now, feel free to use the contact form for any comments or questions.