Embeded Sieve of Eratosthenes: Hunting Primes on ARM

Embeded Sieve of Eratosthenes

I ended up with just enough time over the weekend to pull together a quick project. I implemented the Sieve-of-Eratosthenes on an ARM chip.

If you haven’t heard of the Sieve of Eratosthenes then you really need to work your way through Project Euler. That’s where I first learned about this method of finding prime numbers. You begin with a list of all numbers, find a prime, then remove all multiples of that prime from the list. The real trick with doing it on a microcontroller is to figure out how to store a large list of numbers in a limited space. The gist of my method was to use a boolean array (I call it a bit-packed array but that may be the wrong way of saying it). The details are found in my project linked at the top.

‘Why?’ is almost always the wrong question to ask around here. But in this case, I did this because I wanted to try out the Bit Banding functionality of the ARM core. These chips have alias addresses that map to a single bit in the SRAM and also some of the peripheral registers. This allows read or write access for a single bit using a single instruction. Turns out that one side effect of 32-bit architecture is having addresses to burn.

Hackaday Links: March 23, 2014

hackaday-links-chain

[Jack] sent us a link to a Metropolitan Museum of Art video showing off a mechanized desk that plays music and has a ton of hidden compartments. Furniture makers of yore built hidden compartments in furniture all the time. After all, there weren’t credit cards back in the day and you had to keep important documents, cash, and everything else on hand. What strikes us is that this mates woodworking of the highest caliber with precision mechanics.

Before you get rid of that old box spring, ask yourself if you need to store dimensional goods. If you rip off the outer fabric, the network of wire inside makes a reasonable lumber rack.

And since we’re talking trash, we enjoyed seeing this water bottle wire spool minder which [Daniel] sent our way.

You know those portable DVD players you can hang from a headrest to entertain the kids on long trips? Well [John's] broke, and like chasing the dragon, once you’re hooked on watching videos during car trips there’s no going back. Luckily he was able to throw a Raspberry Pi at the problem. He now has a portable OpenElec XBMC device controlled via a smartphone.

[Jaromir] posted some breakout board footprints that you can use. It’s not the footprints that impress us, but the idea of using them to fill up board space when spinning a new PCB. [Thanks Sarah]

LEGO Gachapon. Need we say more? Okay, truth be told we had to look it up too; Wikipedia says it’s spelled Gashapon. These are coin-operated machines that dispense toys inside of plastic capsules. This one’s made of LEGO and it’s awesome.

[Mikhail] actually built his own ballast resistors for some HeNe laser tubes. This is a bit easier than it might sound at first, as they are much lower power than the tubes used in cutters. But none-the-less an interesting, and successful, experiment.

Fluke Issues Statement Regarding Sparkfun’s Impounded Multimeters

fluke-reponds-to-sparkfun-dmm-impounding

Fluke just issued a response to the impounding of multimeters headed for market in the United States. Yesterday SparkFun posted their story about US Customs officials seizing a shipment of 2000 multimeters because of trademark issues. The gist of the response is that this situation sucks and they want to do what they can to lessen the pain for those involved. Fluke is providing SparkFun with a shipment of genuine Fluke DMMs which they can sell to recoup their losses, or to donate. Of course SparkFun is planning to donate the meters to the maker community.

Anyone with a clue will have already noticed the problem with this solution. The impounded shipment of 2k meters will still be destroyed… eh. The waste is visceral. But good for Fluke for trying to do something positive.

Before we sign off let’s touch on the trademark issue for just a moment. We can’t really blame Fluke too much for this. The legal crux of the matter is you either defend your trademark in every case, or you don’t defend it at all. In this case it was the border agents defending the filing, but for ease of understanding we’ll not go into that. On the other hand, speaking in general business terms, the way things are set up it is advantageous to acquire a trademark specification that is as broad as possible because it helps to discourage competitors from coming to market. So trademark is good when it keep hucksters from trying to rip off consumers. But it is bad if applied too broadly as a way of defending a company’s market share.

Where does Fluke come down in all of this? Who knows. There is literally no right answer and that’s why the discussion around yesterday’s post was full of emphatic arguments. A Fluke meter is a cream-of-the-crop device and they have the right (and obligation) to ensure that reputation is not sullied. SparkFun serves a market that probably can’t afford a Fluke at this time but may some day in the future. And this is the reason we can feel okay about this outcome.

[via Twitter]

Fail of the Week: The Demise of Lil’ Screwy

fotw-demise-of-lil-screwy

The subject of this Fail of the Week installment is entertaining if nothing else. [Chris] decided to see what kind of forces his home-built 100 ton press could stand up to. Turns out the press failed at punching a 1.5″ hole through 1/2″ plate steel.

If you didn’t see it back in February make sure you take a gander at the premier of Lil’ Screwy. The diminutive press packed quite a bit of punch, using four hand-cranked screws to knock out holes in metal. [Chris] decided to tie-one-on and take his lathe for a spin to machine the larger 1.5″ punch set.

He probably should have known when he switched from a 4-foot ratchet to a crescent wrench with a 12-foot pipe for leverage that this was going to be more than the press could handle. The bottom plate seen in the image above is beginning to cup, which in turn jams up the screws in the off-kilter threads.

We fell a bit guilty in admitting we love to see equipment pushed to the point of failure like this. But perhaps that’s part of what this column is all about. Our favorite is still the PCB shear failure, but this comes in at a close second. Check out the video presentation after the break; just be warned that there’s a bit of rough language as part of the narrative.

[Read more...]

You are Fined 1 Credit for a Violation of the Verbal Morality Statute

demolition-man-verbal-morality-monitor

Some citizens can control their language and others cannot. What is a civilized society to do? In a dystopian future you can count on electronic monitoring. But wait, the future is now… or it will be in a few weeks. [Tdicola] is building the verbal morality monitor from Demolition Man as his entry in Hackaday’s ongoing Sci-Fi Contest.

Currently the project is in the early planning phase, but holy cow this is a fantastic idea! For those that didn’t see the glorious 1993 feature film, the young [Stallone] pictured above is accepting a ticket (as in: he must pay for his violation) from the tattle-tale wall-mounted computer. Everything about this device is completely feasible using today’s tech. It needs voice recognition and a list of naughty words, a way to play a pre-recorded message, and a printer to spit out the tickets. The build log for the project outlines all of this, as well as possible cost and sources for each.

We’ve been wondering who it was that injected an Artificial Intelligence into our project hosting system. We see both [tdicola] and [colabot] are on the team for this build. The names are too conveniently similar to be a coincidence, don’t you think?

Multimeters Without A Country: Fluke’s Broad Trademark Bans Yellow Multimeter Imports

fluke-killing-sparkfun-for-being-yellow

Check out this SparkFun Digital Multimeter. Does it make your blood boil to see them ripping off Fluke by using the color yellow? From SparkFun’s side of the story that’s exactly what’s happened here. They have a shipment of 2000 of these things stuck in customs. The trademark being infringed upon can be found in their article. Fluke owns the trademark on multimeters with a dark face and yellow border. Great. This seems like a wonderful idea, right up there with Apple owning tablets that are shaped like a piece of paper.

Okay, so if you’re not crying big fat tears for Fluke being taken advantage of in this way let’s talk about more immediate issues than fixing trademark, patent, copyright, and all of the other screw-the-little-guy type of laws (not that SparkFun is necessarily the little guy but you know what we mean). The DMMs sitting in a warehouse are costing SparkFun $150 per day. We believe they have no option of choosing a warehouse with a lower cost as we must be talking a pallet or two, right? The only two options they do have are shipping them back to China where they were manufactured, or having them destroyed. The former will cost more in re-import tariffs than the cost of the product, and the latter comes with a $150/hour disposal fee and no metric on which to judge how long it would actually take. We hate seeing this kind of waste, but sure enough 2000 DMMs are headed for the shredder in a couple of days.

We know you already have your flaming sword in hand, but simmer down for just a second. Fluke makes great products, ask anyone. And companies the world over defend their trademarks. Hopefully there will soon be a positive response from Fluke on this one. If you would like to politely encourage them to do the right thing we found Fluke’s Facebook page URL in the SparkFun comments thread. Both are worth browsing.

[Thanks Chris via Reddit]

Hackaday in Shanghai: Electronica and a Gathering

electronica-china-shanghai-gathering

Whether you live in Shanghai, are at Electronics China representing your company, or by dumb luck just happen to be in town this week you can meet some of the Hackaday crew and score yourself some sweet swag.

Anyone in town on Thursday night will want to get a ticket to Hackaday: The Gathering. Right now it’s all sold out, but we hope anyone with a ticket who is unable to use it will cancel so that another may take your place. Free food, drink, t-shirts, stickers, and other swag await… no wonder the tickets are already gone!

The Electronica China conference started Tuesday at Shanghai New International Expo Centre, but it runs through Wednesday and Thursday as well. We’re attending, but we don’t actually have a dedicated booth. Hackaday is piggybacking with EEFocus, the Chinese contingent of our parent company. Both [Matt] and [Alek] will be hanging around the EEFocus booth (#W3.3686) shucking out hackaday T-shirts if you ask for one. Before he left, [Matt] mentioned that he’s excited to attend lectures on connected medical devices, the Automotive and EV boards, as well as the embedded systems forum.