Tuesday, August 30, 2011

Editorial: Our friend Microchip and open source


August 30, 2011 in open source, PIC by Ian

Microchip jumped into open source last spring with the chipKIT Arduino-compatible development boards and open compiler/IDE. They wanted to tap the existing tutorials, enthusiasm, and customer base of Arduino community, and they were going to play nice with open source. A review of the chipKIT situation today is disappointing. The compiler still replies on closed source, and there won’t be open drivers for key advertised features like Ethernet and USB.

Microchip parts are used in most of our projects. We think they make great chips, and PIC debugging tools are cheap and plentiful. We use Microchip stuff in open source, but Microchip isn’t always open source friendly.

When Microchip dropped the chipKIT we were optimistic. Microchip invested in the Arduino IDE and released an open source compiler for PIC32. Ethernet and USB shields were in discussion at the time (now available), and we speculated that there would be an open source USB and TCPIP stack.

Four months after the fanfare of the chipKIT launch, things aren’t quite as rosy.

Compiler issues

Microchip’s compilers are based on the open source GCC compiler, but they keep some special sauce locked up. Replacing the closed parts isn’t trivial, there aren’t any alternative open source compilers for most PIC chips. Microchip gets the benefit of a community-developed free compiler, but they keep key parts closed that prevent open alternatives. Not all manufacturers do this. Atmel played nice with open source compilers and were rewarded with the Arduino community.

We were assured there was no funny business with the chipKIT compiler, but as of today there are still parts of the chipKIT toolchain that are not open. The standard C runtime library is not available as source. This is not part of the compiler specifically, but it’s needed to build the libc.a file used by the compiler. Microchip cannot make the current version open source due to license agreements with other companies. Without this code, the chipKIT compiler is incomplete. You cannot take the github source and end up with the working package they distribute.

There are solutions to the compiler issue. The open source Newlib standard C runtime library is an alternative. Porting isn’t a pipe dream either, the Pinguino project has already done it.

Closed source drivers

This week saw the launch of Digilent’s network shield. It supports the Ethernet and USB features of the chipKIT MEGA. Some drivers are needed to do anything useful with it, the most basic are a TCPIP stack and a USB stack.

We were optimistic that Microchip wanted to play fair with the Arduino community. They would release open source drivers to support these heavily advertised features. Unfortunately, it’s not going to happen. Only Microchip’s closed-source drivers are available to support Ethernet and USB on the chipKIT network shield.

Microchip has fantastic USB drivers, and TCPIP drivers with web server demos and other good stuff. They are available under a free-as-in-beer but not free-as-in-speech license. You can get the code from their website if you agree to the Microchip Application License, appropriately abbreviated ‘MAL’. It prohibits distribution, use with non-Microchip products, and gives them:
the right to reasonably inspect Licensee’s premises and to audit Licensee’s records and inventory of Licensee Products in order to ensure Licensee’s adherence to the terms of this Agreement.
Heavy stuff, not open source friendly. We use the Microchip USB and TCPIP drivers in several open source projects. Since we can’t redistribute their code, we only include our own files in the source, you have to get the USB driver from Microchip on your own. This isn’t a huge deal, but it’s a definite barrier to a curious newbie who wants to learn more about Microchip’s products.

We don’t understand the advantage of these restrictions. Would a competitor like Atmel risk the appearance of weakness by replying on code from PICs? There are abundant free and open USB options for most other platforms (AVR, ARM), so lock-in doesn’t stop people from using a competitor’s chip. Clearly Microchip is aware of the advantages of open source because they rely on the GCC compiler and want to be in the Arduino ecosystem.

Digilent is the designer, manufacturer, and distributor of the chipKIT hardware. We applaud Digilent for releasing all the files for their chipKIT designs under an open source license.

Gene from Digilent stopped by the comments last week and gave us some background on the TCPIP and USB support for the new shield. The chipKIT team pushed hard for open drivers, but lost. Digilent may write drivers, but that’s a huge project that couldn’t possibly be a good investment for a development board maker. We urged Digilent to adopt the open source JTR-Honken USB stack and help us build a top-notch community driver without restrictions.

Why it matters

It’s great that Microchip invested in the Arduino open source IDE. Unfortunately the contributions seem to stop with support for their product. Parts of chipKIT toolchain are still closed-source, and Microchip isn’t contributing open source drivers for the highly-advertised USB and Ethernet features of the chipKIT Mega.

We buttressed this editorial by saying we’re huge fans of Microchip stuff. It’s their time-honored right to deal in closed source software – most companies do! With the chipKIT, however, Microchip wants to tap the Arduino buzz. They want promote products using the work of an open source community, but they’re not participating in the spirit of that community. It’s not illegal, it’s being a bad neighbor.

We urge Microchip to give something significant back to the community they’re tapping. Open source drivers for the chipKIT shield would be a great first step.

Sunday, August 21, 2011

Preparation of Pure Manganese Dioxide from Batteries

Backyard Chemistry

Background

Manganese dioxide (MnO2) is a jet black powder found in pyrolusite, nature’s most prevalent manganese ore. They are several different crystalline forms of MnO2 and most are not nearly perfectly stoichiometric. Manganese compounds exist in oxidation states from +2 to +7 so with a +4 oxidation state manganese dioxide is already sufficiently electron hungry to serve as an oxidizer in many applications. Its main use by far is in dry-cell batteries, both carbon-zinc and alkaline, where it is reduced by zinc powder to manganese oxide hydroxide. The typical chemical reaction given to describe the processes of such batteries is:
Zn + 2MnO2 + 2H2O --> 2MnO(OH) + Zn(OH)2

This diagram serves as my map when mining old batteries for chemicals. The manganese dioxide is located along the outer walls of the batteries and is simply scraped off. Unfortunately, the manganese dioxide is not nearly pure and is also mixed with graphite and no doubt also has various zinc impurities. It also probably contains a host of lower oxides/hydroxides that need to be removed. This information from the MSDS of Duracell alkaline batteries should give you a good idea of just how rife such impurities are.
Manganese dioxide- 35-40%
Zinc- 10-25%
Potassium hydroxide (35%)- 5-10%
Graphite, natural or synthetic- 1-5%
Cleaning up this mixture of chemicals turns out to be much more complicated (and more intriguing) than your standard textbook filtration and recrystallization processes. The problem lies in the fact that both carbon and manganese dioxide are insoluble in water and all other solvents as far as I know. Therefore, I have developed a way to separated manganese dioxide chemically from the graphite and subsequently regenerate with a series of reactions.

Saturday, August 6, 2011

Tuesday, August 2, 2011

Swede held for building nuclear reactor in his kitchen

Peter Vinthagen Simpson
Published: 2 Aug 11 12:36 CET

Swedish police have detained a 31-year-old man in Ängelholm in western Sweden who was discovered after he sought advice from authorities on the legality of building a nuclear reactor in a domestic kitchen
 
The man began his experiment some six months ago and has reportedly been open about his plans to construct a nuclear reactor in his apartment in the small Swedish coastal town, maintaining a blog of his nuclear adventure.

The man, who explained that his interest in nuclear physics was awakened as a teenager, ordered some radioactive material from overseas and acquired more by taking apart a domestic fire alarm.

Despite the man's frank and full disclosure of his experiment, his activities only came to the attention of the authorities a couple of weeks ago when he contacted the Swedish Radiation Authority (Strålsäkerhetsmyndigheten) to inquire if it was legal to construct a nuclear reactor at home.

The man was told that somebody would be sent to measure the levels of radiation in his flat.

"When they came they had the police with them. I have had a Geiger counter and have not detected a problem with radiation," the 31-year-old told the local Helsingborgs Dagblad (HD).

The man was arrested by the police and taken in for questioning. He admitted to his plans and was later released.

He told the newspaper that had he succeeded in building a nuclear reactor, generating any power would probably have proved beyond him.

"To get it to generate electricity you would need a turbine and a generator and that is very difficult to build yourself," he told HD.

The man is reported to have spent around 6,000 kronor ($950) on his project and after all his equipment was seized in the raid, he has confirmed that in the future he intends to focus on the "theoretical" aspects of nuclear physics.

Monday, August 1, 2011