Monday, February 6, 2012

Arduino has left the building.

Like many of you, I'm a fan of the Arduino products. But the team's recent upgrade to version 1.0 has left me wondering if they actually understand what they have created.

Let's back up a bit. What exactly is "Arduino". At first glance, it's a family of open source boards each featuring an Atmel AVR processor. Nothing really unusual here. They generally have a simple connection to a host development PC. Yeah, that's been done before. More importantly, it's a complete development environment that makes it really easy to get something running. The IDE (integrated development environment) is pretty rudimentary - nothing particularly ground breaking there. Serious developers will decry the lack of debug support - "print statements are so 70's". But, the real strength of the Arduino is in all the libraries that are available. Want to do PWM, got it. Want to read analog, got it. Want to talk to x, y or z IC, probably got it. No more staring at intimidating datasheets to figure out what registers to twiddle. Lots of libraries for this or that and tons of sketches showing how to use them. A wet behind the ears newbie blasts their ego stroking beacon, blinking out "I got it to work" with almost no effort.

So what is Arduino? It's EASY. Simple. Friendly. Fun. and, oh so gratifying.

Snapping back to the topic at hand. Here comes Andy Artist who want to put a bunch of RGB LEDs in his mobile "True North". He wants the color of the balanced acrylic balls to turn blue when pointing north, red when pointing south and fading to different colors in between. With the new magneto sensors, this is a pretty easy concept and actually not very hard to do. Andy hears that Arduino is really easy so he goes looking on line. He finds someone that has done something similar to what wants. From that he figures out he needs to order an Uno, some RGB LEDs and a module based on an HMC6352 compass (magneto sensor, in the parlance). He found lots of code to drive it and has read enough to have confidence he can actually make it work.

The package arrives and he pulls everything out. The first thing he needs to do is download "Arduino" (the IDE). He gets it installed and is soon talking to the Uno. He starts playing with the RGB LEDs and in short order he's making all sorts of color. His confidence soars! Then he hooks up the HMC6352 and loads up the example code which supposedly works. He presses "verify" ('cause in Arduino, you don't compile) and BLAM! he gets slaughtered with a ton of error messages, all very confusing and obscure. After all, Andy is an artist, not a propeller head. His confidence falls through the floor. He might give up at this point, victim to some obscure dogma that the Arduino team has adopted.

Hopefully, Andy isn't the quitting type and digs a bit deeper. What he discovers is that the example code he got isn't up to date with Arduino 1.0 and the developer needs to fix it. "Please check with the author for an updated version." Maybe he finds the author. Maybe he doesn't have a clue who that is. Maybe some kind soul sends him an updated version. Maybe he just gives up. No matter what the outcome, do you think Andy is a big proponent of Arduino? "Man, I got it working but it was really hard."

What happened here? The Arduino developers decided that they needed to makes some changes for the 1.0 "final" version. They renamed an internal file "WProgram.h" to "Ardunio.h". Also, "Wire", a key library, was changed to make some of the function names more "correct". Unfortunately, a lot of code was written that included "WProgram.h" and used the old Wire names. In 1.0, they all broke! So, how hard would it have been to preserve the old wire interfaces? Or leave WProgram.h alone instead of renaming it Arduino.h? (Or even just including Arduino.h in Wprogram.h???) Yes, Arduino is free and the developers can do anything they want but these changes indicate a total lack of understanding what they have created. And the trivial issue of WProgram.h vs Arduino.h indicates more interest in adhering to some techie dogma than making it easy for the Andys of the world to create using Arduino. What is really distressing is to see the invective being heaped on people who point out this rather obvious issue. I hope that the Arduino team is learning from all this. I certainly hope that Arduino has NOT left the building.

Saturday, February 4, 2012

Wall Warts




Oh, the ubiquitous wall wart!

Wall warts, AKA wall power adaptors, are everywhere yet there seems to be a lot of misunderstanding about them. People are often surprised when a 12V wallwart measures 16V on the multimeter. Thus, this blog.

The first thing to realized about WWs is that they usually are UNREGULATED power supplies. There are regulated wallwarts but they are definitely less common and we won't look at them today. Some of them have nice big filter capacitors and decent transformers. Others, well, let's just say they don't. The device a wall wart plugs into is responsible for creating clean power. Generally, everything works fine but when it doesn't...

A big confusion point is about the labeled capacity of a WW. I have in my hands one that claims 7V at 700 mA. Why then does it read 11.4V when I measure it without a load and 10.7V with an 18 mA load? It goes back to the fact that it's an unregulated supply. Ohms Law, baby! In theory, if I placed a 10 ohm load on it, It should read 7V with 700 mA current. Yes, we know that label is probably more marketing fantasy than engineering reality but let's roll with it anyway.

So, what does my little WW do under different loads? I pulled out my junkbox and found some power resistors to measure against. First, I measured their actual resistance. Then, I measured the voltage drop across the resistors. It's all pretty predictable based on Ohms Law but here are my results.











In graph form, it becomes a bit clearer















Unfortunately, I didn't have a 10 ohm, half watt resistor to use but it looks like it would have come pretty close to the rating of 7V at 700 mA. Remember, Ohm's Law says that R = V/I. So, my little $0.50 wallwart that I got from a thrift store looks like it actually delivers on the promise of the label.

Another confusing point about wallwarts is that even educated engineers often think "bigger is better". If given a choice between 12V, 300 mA and 12V, 1A, take the 1A one. The extra current means it won't cause problems. Right? The answer is a definite maybe. You really need to look at what your circuit draws. and what kind of power supply you have. Going back to the measurements I did, you can see that my 7V/700mA WW delivers approximately 10V with a 100 mA draw. Feeding that through a 5V linear power regulator, we will see 5V drop. That's 1/2 Watts of power being put out as heat. How will the poor little regulator handle it? Let's look at a common regulator, the LP2985-50. It's in a tiny little SOT-23 package. The datasheet says it has a thermal resistance of 208 C/Watt. This means that the device temperature rises 208 degrees C for each Watt dissipated. In our case a half watt would increase it's temperature by 104C. Adding that to the ambient temperature of, say 25C, we get 129C. Not killing the chip since it can go to 150C but hotter than boiling water. And if the regulator is not exposed to free air, it will get even hotter. Needless to say, not the best plan. So, maybe that little WW isn't such a good idea for powering a fairly loaded Arduino system.

Finally, I pulled out 4 more random wallwarts from my junk box and tested them. Here are the results. I highlighted the places where I exceeded the spec'd current. As you would expect, the voltage drooped below the spec. Nothing exploded but I'd expect the WW to get pretty hot over time. Definitely NOT recommended.


















As you can see, three of the four deliver at least as they claim. The 12V/300mA WW appears to not be delivering as promised. It hits 12V at 250 mA. I would guess it delivers about 11.4V at 300mA. Not the end of the world and it's usable for small projects.

Let's go back to our calculation of temperature rise. Looking at the 12V/300 mA WW, it will probably deliver around 13.75V at 100 mA. That's 8.75V of drop through the 5V regulator for 875 mW of heat or a 182C rise. Adding ambient temperature of 25C and we are getting close to the point of melting solder! And touching the voltage regulator would give you a vivid demonstration of power dissipation. Yikes! All that from a puny 100 mA draw. Kids, don't try this at home. And, when you look at the 12V/800mA WW, add another 1.5V for over 10V of drop. That would definitely turn your sweet little arduino into a blue smoke dispenser. Bigger definitely is not better.

The lessons learned from from this exercise:
  • The voltage spec on a wall wart is for the specified current.
  • The lower the current you pull, the higher the voltage.
  • Higher current wall warts will have higher voltage.
  • Linear regulators turn the voltage drop into heat.
  • Keeping your voltage drop lower is good.

So, I think you can see why I really like my 7/700 $0.50 thrift store wall wart!

Friday, July 16, 2010

Droid X

Well, I got my Droid X yesterday and have all of 12 hours on it but have come to some conclusions.

High order bit - I like it. A lot. Fantastic piece of hardware except for the camera tumor on the back.

n-2 bit: Motorola needs to disabuse themselves of being a software company. They're not. Period.

So, the hardware: You can find the specs elsewhere but in brief - 1 Ghz processor, 4.3" LCD display, 8 mp camera, 3 mics and all the usual smartphone suspects. This puppy is really thin. Most of the phone is just a hair over 10mm and the top 20mm of it bulges out to 14+mm for the camera. Overall, it feels ok in my medium sized hand though people with really small hands may find it a bit too big.

The 4.3" screen is very nice, displaying images with a lot of clarity and crispness. The bezel on the sides is about 5mm (<1/4") so the LCD seems to really fill up the case with image. The phone is a bit longer than I'd like - they could have trimmed 7-8mm. Still in all, this is one big slab-o-pixels. One "complaint" is it's pretty unreadable in direct sunlight but I'll trade battery life for that any day.

Wifi, bluetooth, 3G all seem to work well and the call clarity is pretty good. The camera seems to work well though the zoom is not that useful. There were earlier complaints of the shutter button being stiff (and causing camera motion when pushed) but mine seems to operate with an appropriate amount of force and pictures seem pretty good. Frankly, I don't like phone cams and would have preferred a version with no camera (and thus no hump).

All the standard functions - browsing, contacts, phone, gallery, ... work as expected. No complaints.

So where is the DX weak? It's page organization is messy and comes with some crapware. More on that in a bit.

The 7 base pages come with a semblance of organization - home, social media, media, phone/contacts, email/messaging, location stuff. Yeah, that's six. The last one seems to be dedicated to the mot social media ap but why that isn't on the social media page isn't obvious. The reason I say semblance is that in a given page, it's kind of random what they've put there. For example on the "location" page they have controls for GPS, Wifi, bluetooth and 3G plus the airplane mode button. Those seem better placed on a settings page (of which, there isn't). When I want to go into airplane mode, I don't think "location". Maybe it's just me. Other pages are like that as well. Skype is on the messaging page and not the phone page. In all, their organization of the 7 pages is just not that clean.

The phone/contacts page is probably the best hint at what they are trying to do - place common contacts on the screen for "one touch" access. A good idea but the initial page set up is confusing with 4 unfilled contact "buttons". It takes a lot of clicking and selecting to actually get to "one touch dialing". I suppose people will figure it out but again it shows that Motorola doesn't really get software.

As for crapware. Perhaps this is an unfair term but the best example is the social media page which pushes you into their incredibly lame attempt at social media integration. I tried it out and found it to be deeply confusing. All they need is the "spot" to complete the mess. So, I installed facebook for android and haven't looked back. I really don't want some unified view of my social media applications. Motorola - keep yer friggin' fingers off my accounts. They also are pushing blockbuster and amazon mp3 with apps on the various pages. Thanks but no thanks. If I want the apps, I'll place them myself.

I disagree with the Gizmodo review in the way they zeroed in the crapware issue. They compared it to the Sony Viao (beautiful HW, tons of crapware) but the reality is that there are a couple of those and the distressingly bad social media app.

Finally, I'm looking forward to the promised FroYo upgrade. If the reports are true, it ought to make the DX really fly!

Summary - beautiful piece of hardware that needs Android to shine through a bit more to make it great.