Archive | January, 2012

Back to electronics and Arduino

31 Jan

Back to electronics and Arduino

After a great week filled with snowboarding, fun and software, it's time to get back into hardware again cool

Waiting for me at the postoffice was a package from Hong Kong and the crazy site DealExtreme. 3 weeks ago I randomly browsed around the site and figured that I'd check to see if there were any Arduino stuff on sale and indeed it was. I found an Ardunio Nano 3.0 for only $17 and an Arduino Mini for only $13. I had to order for more than $30, so I threw in a bag of super-bright white LEDs as well. The Mini is still on backorder, but check the image above to see how small the Nano is? Including FTDI/USB it's still less than one fourth the size of a Uno! It plugs straight into a breadboard and it's a fantastic deal at only $17.

This is one of the things that facinate me with the Arduino community. The Arduino Nano was originally conceived by the California company Gravitech. True to the idea of the platform, Gravitech publishes the Nano with a Open Source/Hardware license that enables others to produce competing products. If you buy from the originator in the US it's $35 per Nano, but from Hong Kong it's only $17. According to what I learned at business school many years ago, this is bad for any company, but that was before we learned about the App Store Economy where volume/exposure matters the most. The Nano platform is also very tied to Gravitech as they update it and they also produce several very nice shields to go with the device. I'm pretty sure that the more companies that sell Nano compatible controllers - the more exposure this form factor will get and Gravitech will benefit.

The Arduino Mini from Asia is still on backorder, but the LEDs were crazy bright. Should fit well for an idea I have, but now it's back to app-making. Almost there...!

gotoAndSki 2012

31 Jan

gotoAndSki 2012

Just back from another gotoAndSki conference in Switzerland and what a blast it was! Just as last year I went to Switzerland with @thomasnesse and @smest for almost a whole week, just to be sure not to miss out on good snow. The first day was simply EPIC!!!

50 cm powder snow, cloudy but with thin skies so there was plenty of contrast and no sunburns. We went offpiste until our legs got cramps and then some. When the conference started a few days later, my legs still hurt so on the sunniest day I spent some hours teaching @inspirit how to snowboard and refreshing the memory of @devboy_org. I was pretty proud to hear that Eugene did a black slope all by himself, only the day after! (while cursing @funkysoul and the others for picking that route).

Eugene Zatepyakin presenting @ gotoAndSki Switzerland

Eugene delivered a great talk about his AR library - in2ar - that now is completely rewritten and free of patents. It was especially impressive to see this running on mobile phones using AIR and Native Extensions! Other favorite talks were @quasimondo's return to public speaking. His session "The naked pixel" is guaranteed to fill any conference room! Dominic's session was also quite nice and worked as a primer on Ruby as well.

It was great fun to meet attendees from last year and to meet some new faces like Franto - one of many that I've followed in the Flash community for many years and only met now. I also talked to his buddy @sHTiF that has written a great 2D engine for Stage 3D (and a Starling alternative) that is called Genome2D. I have to finish up a couple other projects first, but then I'll definitely test how this engine plays with my MineGunner project! Seeing Adobe's @tomkrcha demo the Genome2D engine on an iPad 2 with 7000 sprites running at 60fps really convinced me that Flash on devices is here to stay! 

I had a great week in Stechelberg so a big thank you to @fcolaco & @almeidavid_ for organizing yet another great event! Given how bad the snow has been here in Norway this year, it was simply fantastic to get to Switzerland for this week. Just check out this picture - beneath that 2.5 meter high sign there is a road somewhere...

Make:Electronics, experiment 14

24 Jan

Make:Electronics, experiment 14

Changed my mind and spent most of of last week working on the app idea. Took a while to get the AIR performance to where I wanted it, but it’s really running fast now even on old devices. Didn’t do any Arduino stuff other than making a couple musical circuits/instruments based on light sensors with my son Walter. Simple, but fun stuff. I then took Monday off from app-making to finish up the first half of the Make:Electronics experiments. Have to say that this book is incredibly good for anyone that just want a solid introduction to electronics. Part of the process is to learn about the limits of components and it’s really fun and useful to fry some circuits.

Fiddled a lot on Experiment 11. I simply couldn’t get it to work. While Googling for an answer, I stumbled upon this picture for Flickr. Then I realized that picking a 570 Ohm resistor over a 570k Ohm will probably break the circuit. If you check out the reviews of the Make:Electronics book, you’ll find that they’re sort of divided into two - those that love hte book and those that feel that the instructions are inadequate. After realizing my own mistake, I now understand why a few of the reviews are incredibly negative. They probably made a similar error, but failed to find the culprit.

Experiment 14 is by far my favorite thus far. It’s shown in the video above. It’s not doing much - it’s just blinking / fading a LED. This would be incredibly simple to do with a Microcontroller like Arduino or a Picaxe, but I learned so much from playing with transistors (NPN and PUT) and capacitors while doing the preparing experiments that lead up to this. Soldering it all up on a protoboard and getting it to work on first try was also a kick!

Now it’s time to take a break from blogging though. Will spend the coming week at gotoAndSki Switzerland - the Coolest Geek Conference around!

GotoAndSki 2012!

Make:Electronics training

17 Jan

Make:Electronics training

Make:Electronics is a book from Make Magazine that provides an introduction to electronics. It’s full of exercises so you’ll need a bunch of components. You can either pick these up at a local electronics store (it’s all standard stuff) but you can also order two nice plastic cases with all the components collected for you. I opted for getting the cases, though I realize that I could have gotten all of this at my local electronics shop - Elfa Elektronikk in Oslo. My plan for this week and the next is to complete this book with all the exercises so I have a better understanding of the hardware side of microcontrollers.

It’ll probably be a little longer between updates as I’ll try my best to stay focused and not play with all my new Arduino toys. I really need to know the basics of this so I can complete a couple of projects I’ve started. You can see a vid of experiment 8 from the book above. It’s a simple circuit that toggles two LEDs, something that would be dead easy to do with a microcontroller. I love how it sounds like the turning-lights of my car! This one is however done using only basic electronic components (a capacitor, a resistor and a relay).

One thing about this kit: Europe is probably not the target for Make Magazine / Makershed, but it would have been nice if the switchable power supply that comes with Make:Electronics Components Kit 1 was an auto-switching one (110/230v). I picked up a European one at my local hardware store (Biltema) for only $29, but I’m sure that it wouldn’t be much extra cost to change the kit to include one of these instead. I have plenty of converter plugs, but none that transforms 110v to 230v…

I’m really liking the style of this book. Not only do you learn through experiments, but you also get to take things apart! In Kit 1 (containing all you need for the first 11 experiments) there are two 12v relays. One is to be used for building circuits, but the other is to taken apart! Loving this approach to electronics! You can see a video of how this “dismantled” relay works below.

 

4050 measuring and loads of new gear!

16 Jan

4050 measuring and loads of new gear!

Spent most of the day making a tiny, but really fast framework for mobile apps in AIR. Will take another day to get it where I want it, but I’m making this fully re-usable and fast to use. The one thing I really want to do is to display a splash-screen as fast as possible, while the rest of the app builds in the background. Think I have a decent method now but will require some more testing. While I was at my Oslo office doing this, my big delivery from Makershed arrived!

Apart from the two component collections there was also some toys for my kids that we spent most of the evening building, soldering and playing with. Great fun!

A word of advice - if you’re in a hurry when ordering from Makershed - make sure you don’t add anything that says it will be delivered from Jameco! Jameco only ships directly to US customers. My whole shipment was delayed at least 7 days while Makershed waited for this single bit to arrive. Not to bad you may say, but when you’ve paid $180 for express-shipment of something worth $340, it’s incredibly frustrating to see a page saying that the order is being “Processed” for the tenth day in a row. When I called up Maker Shed’s customer service they were really helpful and said that this wasn’t supposed to happen. They removed the shipping cost as a “sorry - now that’s really good service!

Seeduino data tracker

I also got another much anticipated package today from Hong Kong! I can’t believe how small this thing is given what it contains? The picture above (click to view full size) shows a waterproof project box from Seeedstudio that has a 0.5w solar cell glued onto it’s transparent lid. In the bottom there’s a seeduino (arduino compatible w/xbee socket and SD slot) that fits right into the box, a xbee compatible GPS, a lipo battery and a 4G cellphone shield. In other words - all I’ll need to build a fully portable tracking system in a 10 x 6.8 x 5 cm box! The kit also comes with a UartSBee that’ll be used to program the board since there’s no USB port like on the Arduino Uno. This is similar to the FTDI Friend, but it can also interface a xbee shield directly. This is gonna be so fun to play with… But I’ll finish the Make Electronics book first before playing. That’s fun too and I’ll need it in the process! So stoked about learning end playing these days that I’m actually having problems falling asleep confused

Exploring the NPX 4050 chip

Tonight I played around a bit with the 4050 chip that came with the display I tested yesterday. I didn’t fully grasp how it worked, but by breadboarding and measuring it a little I found that it was really simple. By default, the Arduino sends 5v for HIGH on all it’s IO pins, but what if you have a component that needs 3.3 volts for signaling via the same pins like an xbee compatible module? Use a 4050 chip to adjust the voltage of the signal!

It’s really simple. Apply to pin 1 (VDD) the voltage you want to scale other signals to and ground to pin 16. After this, all the 6 IO’s on the 4050 will scale HIGH signals down to the reference voltage applied to pin 1. The chip can do this for anything from 0.5 to 15 volts, so it’s really flexible. Very happy to have found this IC and I’m sure that the coming days of exploring Make Electronics will bring more like that.

PS: With todays shipments I now have 5 (!) different Arduino’s and there’s even more coming soon. If you’re in the Oslo area and happen to fry yours - you know who to call, right? tongue laugh

ST7565 display and app idea

15 Jan

ST7565 display and app idea

Realized that there’s no decent mobile reference-app for Arduino while sitting on the bus the other day, so I’ll spend some time this week making just that. I did a first version using Flex Mobile on friday and it wasn’t very responsive at all. 2 seconds to open a small utility to calculate resistor values? I think not. Will do a version two based on pure AS3 to get that extra speed. I’m eagerly waiting for packages filled with fun Arduino-stuff and electronics from all over the world at the moment, but I had some time tonight to play with the ST7565 display from Adafruit today.

It was very easy to get up and running using this tutorial from Ladyada but there’s one major omission in this kit. The screen cannot take more than 3.3 volts on the IO pins so to ensure people don’t damage the screen, the nice people on Adafruit have included a NXP HEF4050BP chip that will reduce up to 6 signals to a safe 3V output. The tiny detail that someone missed is that for this RGB screen, you need 7 signals to fully drive the RGB color display. It’s not a problem for me as I got to do the testing I wanted though only in either R, G or B smile

What I was curious about is at what speed can my Arduino Uno drive such a screen? Testing showed that it does about 2 fps with only few pixels updating. I had hoped for higher speed and maybe building a quick 2-player Pong-game using two encoders and this screen. At 2 fps, it’s not worth the effort. I’m not too good at C, but the library looks quite efficient. The screen buffer is a 128x64 byte-pattern that you change using bit-math. If you set the first byte to 0x1, you’ll turn on the pixel at 0,7 (x/y). If you set it to 0x2 you’ll turn on the pixel above (0,6) and with 0x3 you’ll turn on both. Fairly simple, but you’d probably want to make some app that could convert bitmaps to these HEX series. The library that comes with it also contains a 5x7 pixel LCD font

The coolest about this LCD was actually the 4050 IC that came with it! Since I’m so new to electronics, I didn’t even know such ICs existed and this one is sure going to come in handy! From what I understand it can take anything requiring 3v and make sure that anything up to 15v is converted down nicely. Very useful!

Why Javascript bores me

14 Jan

Update: I feel that I should add to this post that working with node.js and socket.io has sort of changed my mood when it comes to Javascript. I'm having lots of fun doing JS stuff these days and even combining it with Flash and AIR.

Now this is going to sound cocky (sorry) but I need to get it off my chest - the thing I hate about the Flash vs HTML(5)/JS/CSS(3) debacle is that clients now expect you to be able to do everything you could in Flash using HTML. They also expect that everything will magically work well on mobile devices such as iPads and cheap Android phones. This is after all the very promise that Steve Jobs and other cool guys have sold them. The problem is - it’s not like that at all.

It’s really hard work to solve browser incompatibilities and code around lack of capabilities in mobile browsers. I don’t mind hard work but this really bores me - a lot. I hate patching something that really should have worked, but since somebody didn’t agree on how to solve it I’ll get to poke around half a day to look for an answer…? It’s much more fun to create stuff, isn’t it?

I don’t mind that Flash’s role is changing. It was inevitable and I too love to see cutting edge work done in HTML/JS/CSS like this brilliant site by Bret Victor or enfantsterrible by WeFail. I just don’t want to go 5 years back in time to the time before Flash Player 9 and Actionscript 3. I don’t mind Javascript at all, but it feels so totally inappropriate to try and build serious apps with it (like I do with Flash and Flex). I don’t want to work on projects where I constantly have to cut back on creativity just because something just isn’t possible (yet). Flash is a platform that does not limit what I can do, so to me this boils down to either having (what I think is) a boring job or finding something more enjoyable. Work takes up too much of my life for it to be boring…

AS3 is such a mature language and if you read up on the future of Javascript, you’ll find that JS5 will be the “patched but still untyped” version of JS. Future versions after that will become what ECMA 4 tried to be before Microsoft more or less killed the project. Flash’s programming language AS3 is what Javascript will become in the future. It probably won’t be exactly like, but it’ll be close. I think that I will look for other challenges while waiting for javascript to mature where working with it no longer bores me.

Others have taken a different route and gone with the flow to do with JS what they have already done with Flash and Flex. I have no need to do that. There’s so many other things to do than have a boring job. Today, João Saleiro posted a brilliant and thorough article that more or less sums up all of my frustrations with “the future” of web development. It’s lengthy, but it’s really worth it - especially if you come from the HTML/JS side. Most HTML5 “comment trolls” don’t know anything about Flash, Flex or AS3, so they have no clue what they are missing…

Sorry. HTML5/Javascript/CSS3 The hype really bore me and I’m already used to Living in the future. I won’t spend time on learning the fancy “flavor of the month” JS-library that may be dead a couple months from now. Instead, I currently enjoy learning about electronics and microcomputers while coding in C - a language that is older than me and still just as valid. And if I ever “have to” to build something big with Javascript, I’ll certainly use something like Haxe that can remove the pain and add some fun.

Further reading?

HTML5 in way more than 5 paragraphs

The Increasing Cost of Interactive Production

The World of Pain that is HTML5 Video

The open web needs you now

PS: I do a lot of HTML, JS, CSS and have done so ever since I started in this business 15 years ago. I also do PHP and EE CMS on a almost daily basis. I just don’t see the excitement in fighting against technology to make it do what have been done already. If being on the bleeding edge requires daily pain and fighting inadequacies/inconsistencies/incompatibilities, I’ll rather look for things more fun to do?

First proper speed bump

10 Jan

First proper speed bump

I love learning new stuff, but I hate to learn that something can’t be done. I spent most of this day trying to make things work, but in the end it proved impossible. I had gotten the RN-XV WiFly Module with a tiny Wire Antenna from Sparkfun, thinking that this would be perfect for remotely controlling my Arduino devices. On the product page there is a picture of the module on a XBee card and the text describes it as a drop-in replacement for Xbee hardware. I guess I need a Xbee shield then? and off I went to order the Sparkfun Xbee Shield from my local supplier Robonor, thinking this would ensure compatibility. Turns out that was wrong.

Spent first part of today visiting customers and friends as well as writing a tiny AIR app that’ll perform simple Telnet-communication. All the WiFly modules can be set up via Telnet and doing stuff like this is really easy in Flash / AIR.

I spent most of the day getting the darn thing up and running. I first soldered the header pins and then made a small circuit on the proto area where I could toggle a switch to supply 3.3v to pin 8 of the WiFly to make it go into AdHoc mode. I prototyped the circuit on a breadboard first and the soldered a permanent version onto the Xbee shield prototype area. Then I realized that since I used the outermost holes in the prototyping area, the switch would touch the USB-in plug on the UNO beneath the shield…
I soon realized that desoldering isn’t very easy when all you have is solder wick, so now I’m getting a proper solder pump as well. I simplified the layout to not include a LED when AdHoc mode was on and moved the circuit a couple rows in. After measuring that the switch did what it should, I tested it and sure enough - the WiFly comes up as a AdHoc network that I can telnet into. That won’t let me control the Arduino though so it was time to code a bit.

Since the WiFly Shield is based on a quite similar chip, I figured that I could probably start by using those tutorials. It didn’t work right away, but there were some good comments on the WiFly SHield page. I got the shield to work in that I got a message from the WiFly chip saying:

WiFly Shield Terminal Routine
Could not initialize bridge, locking up.

This meant that I could not write to the device. Also - when the Xbee shield was on, it was impossible to program the Arduino. I kept getting the error message “avrdude: stk500_recv(): programmer is not responding”. I’ve read about this before and it’s usually a short circuit or something blocking the RX pin on the expansion board. I really got to use my magnifying lamp here… I traced all the circuits on the board, compared it to the datasheet for the RN-171 chip an the RN-VX. I couldn’t find a clue.

That’s when I realized that in the world of electronics - there actually is live human support! Coming from a software background I’ve gotten used to the fact that if something fails, you have to fix it yourself or pay extra money to get expert help. I called up Sparkfun and got to talk to their support ppl that told me to desolder a SMD diode and short it with a wire. That should prevent the programming problem. I did this, but had a hard time debugging if my soldering was working as when I measured - it didn’t show a connection. After another call to Sparkfun they told me where to measure and also said that when programming the Xbee shield, I had to toggle the tiny switch from UART to DLINE. After programming, it should be set back to UART. I had tried this before without success, but this time it worked! I could now program the Arduino without removing the shield. Apart from that - no dice. The support rep told me that he had not seen anything posted on using the RN-VX with the Xbee shield so it might not even be possible… Dead end in other words.

I’ve realized that I need to learn more about serial UART comms and how the I/O works. I’ll also skip the shield and use some test hooks directly on the RN-VX to see what I can get out of that. Fingers crossed that I won’t burn it up as it’s a bit sensitive to high voltage. Guess I’ll lower the current with a plain resistor? I’ll post my findings as I get to it but it could take a few days - I have to do some accounting or my wife will kill me smile

(update Jan 16th: solved the voltage problem!)

IR Remote Control

09 Jan

IR Remote Control

Since I got a bunch of different IR sensors and IR LEDs just before the weekend, I knew I wanted to play with that as soon as the weekend was over. Started out with Ladyada’s tutorial but had limited results. I could read codes, but sending them back didn’t work too well. I then remembered Ken Shirriff’s blog. He’s written a great library for working with IR and it’s rock solid. I ended up using one of his examples together with a piezo buzzer so I had some audible feedback on the codes learned.

The problem of sending codes remained and I scratched my head quite a bit on this one. It then dawned on me - I’m not driving the LEDs at max current? Sure enough, everything including my early tests worked fine as long as I held the IR LED about half a meter away from the device I wanted to control. Really eager to get my Make:Electronics kits now so I can learn how to adjust the current to what I need!

Fascinating to see how many of the IR devices I have in my house that use the NEC protocol. Due to the limited range, I can’t take this part further now but with some luck I’ll be able to hook it up via WiFi in a few days. Should be fun!

Since I got a selection of different IR sensors, I had to figure out how to use those that didn’t have the typical three legs. Turned out to be very easy as you can see from the Fritzing diagram.

Arduino: The Documentary

06 Jan

Arduino: The Documentary

Just finished watching Arduino The Documentary (press play above to check it out) - a great backgrounder for anyone getting into Arduino and Open Source Hardware. Also great fun to see Phil Torrone that I met in both San Fransisco and London for the first FlashForward conferences. He’s now working at Adafruit - my favorite place to shop anything Arduino. Adafruit almost always ship the same day I order anything and offer very good service if anything is missing/wrong with your order. Stuff I order from them will often arrive before things ordered in my home country of Norway, so that’s pretty solid!

I spent lots of time yesterday modifying my workspace to suit working with hardware and soldering. It takes a lot more space and it also requires entirely different lighting than I had. I actually ended up going to the store of The Norwegian Association of the Blind to buy a really powerful lamp that has a magnifying glass built into it! It’s powerful (150 watt equivalent), super flexible and usually used by professionals like dentists and such. Another thought that comes to mind with such a lamp is the elderly woman across the street where I grew up that could hardly see anything, but used a similar lamp when sowing… Didn’t ever think I’d buy something like that, but it’s REALLY useful when working with tiny hardware.

Also soldered and played with a couple shields that I got from Sparkfun last week. The MP3 player shield was really easy to get up and running, but I need to learn how to build a small amp for the output as I have some cool ideas for this shield.