Posted by: Claudio Carbone | 24 September 2011

Me and embedded ethernet (Microchip PIC32)

These days the embedded technologies have achieved very low prices and unbelievable capabilities.

With about 70€ you can take home a 32bit microcontroller with 512KB of flash rom (for program code) and 128KB of ram.
It pales in comparison with the lowest netbook, but we are talking a different scale here.
These things can almost be mounted by hand, interfaced with all sorts of things: infact they are at the heart of some of the Arduino boards.

Now this starter kit I got (see here for more info) got an ethernet adapter on board.

Pic32 Ethernet Starter Kit

Pic32 Ethernet Starter Kit

Which means that with comparably little effort you can have your embedded application go online.
Doesn’t look lime much when the average smartphone does the same and better, but when you see that you can do almost everything without ever getting an operating system around, it starts sounding different.

A word of advice though: these things are complex by themselves, and implementations are even more complex.
It took me the best part of today to get a demo to compile correctly on my computer and run on my hardware.
It was nowhere straightforward as I would have liked.

Path alignment is a nightmare, and the Demo is loaded with so many things that compile time averages 10 minutes.
But in the end I was greeted with the welcome page (a masterpiece of how NOT TO design a web page: it tears firefox down in minutes with all the dynamic ajax) and after another 30 minutes of fiddling I was able to enhance the site with a webpage of mine.

Embedded web server test page

Embedded web server test page

Posted by: Claudio Carbone | 19 September 2011

The italian public debt on a glance

I found a nice counter, like those used for showing the number of accesses to a site.

Only difference: it shows the ever growing italian public debt.
Unfortunately doesn’t allow for scripts on the pages, or at least I don’t know how to do it.

So here is the link to the live counter. It can also show the per-capita quota of the debt.
More then 31000€ with a per-capita GDP of 29000€.

You can see where we are going…

Posted by: Claudio Carbone | 24 August 2011

Train kissing, a possibile new extreme meme?

Ok that’s positively crazy, but this was a stunt no doubt on it.
A stupid youth, later convicted for public service interruption and attempting to public safety, made his run in front of a 90kmh train…
Seriously, has adrenaline dependence reached such freightening heights?
See for yourself

Posted by: Claudio Carbone | 24 August 2011

Don’t you ever have enough of technology?

I think enough’s enough.
The journalist said the woman is an Apple Store employee, that’s the only reason why I could justify this: as an Apple viral campaign.
Otherwise, we’re already doomed…

Posted by: Claudio Carbone | 14 August 2011

Solar tracker follow up (number 1) 

So I left you with some shots of my “solar sensor array”.
Work as progressed somewhat.
Previously I was using a board I had laying around, based on a PIC 18F2550. Capable but just so much.

PIC 18F2550 based custom board

PIC 18F2550 based custom board

The software is currently working on the card, outputting backup messages on the emulated serial terminal via USB CDC and correctly tracking the light source shone on the sensor array. By working with it I learnt that calibration is a necessity no matter how much precision you put in the design prior to powering it up: there will always be minor misalignments. But! The way I designed the software, it was almost imploring me for calibration factors! Putting them in is a breeze.

The way it’s shaped is like this (sorry, no flowchart):

  • there are 2 PI controllers, one for each axis
  • the misalignement error is fed to a low-pass filter to limit jittering and spiking
  • the slowed error is then fed to the PI controllers, whose integral part has fixed anti-windup limits (to prevent overflow and speed up error recovery, since an infinite error would be useless anyway)
  • the anti wind-up limits also offers an easy way to limit movements (for example on the tilt axis, were a full 180° are not used)
  • the errors are calculated after raw data acquistion as a comparison (substraction) between the reference voltage from the paired precision resistors and the half bridge for the signal in question (X or Y), it’s here that adding a constant for each error is a breeze! so compensating for physical discrepancies is easy

But then my mind got entangled with an idea…

Lurking on the ever expanding seas of The Bay, I found a small business selling el-cheapo cards, clearly rip-offs of the much higher priced Microchip demo boards, but they did fit my design. So I payed the small fee to receive a brand new PIC 18F46J50 demo board!

PIC 18F46J50 demo board

PIC 18F46J50 demo board

They may be el-cheapo but construction is sound, features are rich, the guys are nice and fast in answering any question, and the designs are theirs! So they know what they did and they provide schematics and examples! Check them out if you’re into this sort of DIY things Mine was about 15€ where Microchip charges about 37€!

Anyway the main question you should be asking (me or yourself, eithter way) right now is: why changing?
Well two reasons, one of which becomes clear if you just skim the datasheets of two chips:

the PIC 18F46J50 has a whole Real Time Clock integrated, spanning 100 years!
This means that this little critter can be your daily alarm clock for your whole life!
And if you design the circuit carefully enough, it could probably run for your lifetime on the very same battery…
But that’s not my point.
You could concot an RTC from any pic, and thruthfully the 16bit Timer O has often been called RTCC.
But, it would never be like this! This is made for it.
It runs on its own crystal at the speed you want, and has a second crystal input just for the timer, so you can choose your flavour of precision clock crystal. Then it keeps track of seconds, minutes, hours, days, day of the week, months, years and even leap years all by itself for a century! What more could you ask?

I was seeking this for a reason: I meant my circuit to wake up at an interval (say 10 minutes) to change the aim of the solar array. Since the sun’s movement is slow, it’s not necessary to keep the circuit tracking it continously. Or at least this is what I think, but having a way to wake up at intervals makes it possible to collect data even on this kind of experiments: I could do test runs at 1,2,5,10,20,30,60 minutes intervals and see how the produced output varies! Fascinating, isn’t it?

And then, a side effect I was not aware at the moment, but came much appreciated when I discovered it: the program memory of the 46J50 is 64K with 3.9KB of ram, where the 2550 has just 32KB and 2KB of ram.
And for my intent it’s still on the small side.

What intent?

Internet power!

18F46J50 and the MRF24WB0MA wifi module

18F46J50 and the MRF24WB0MA wifi module

In the picture above you can see the teeny-tiny MRF24WB0MA embedded wifi module compatible with Microchip’s free TCPIP stack.
With an easy to use GUI you can configure the basic operating environment for the stack, which then takes care of everything itself.
Youtube is full of little webserver demos running on these minuscule microcontroller. It’s astonishing!

So what’s my idea?
To mount the total solar tracking system on the roof, powered by a self-recharging li-ion battery (two solar panels: one feeds the system and the battery, the other provides power for the power gauge and power output experiments) and connect it to my wifi to have it synchronize time periodically (RTC calibration is beyond my willingness to pursue it) and upload power data to a webserver.

This way data analysis is a breeze: just download how much data you want, and plot away!

Will I get through it?
Don’t know, the TCPIP stack is huge and I can’t find a decent documentation. Also it was my intent to use both the TCPIP and USB stacks at the same time, to use the USB as a debug console, but it may be that there is not enough program memory for both… We’ll see, in the mean time I’m waiting for a pan/tilt mount to come from china: I couldn’t bother designing my own, so I just bought one for about 30$. It should be able to handle the two little solar panels.
I’ll keep working on the software side for now, leaving the Wifi to wait a bit.
I also have to find a way to connect the SMD wifi module to the board. And probably I’ll have to wait till shops open up after the holidays to buy me some wire-wrap wire and a couple resistors I don’t have.

Posted by: Claudio Carbone | 18 July 2011

And the OLD won over the NEW another time.

So I finally got myself a shiny new NAS.

What is a NAS? Easy: it’s a networked drive! It sits there, holding your data, always available.
The more you pay, the more things it can do: download things for you, schedule backups, mirror your data to enhance security, and more.

So my new Netgear ReadyNAS NV+ is on the low end: 200€ diskless.
It doesn’t even have an x86 cpu, instead it sports an aged Sparc (once Sun) and 256 MB (!!!) of ram.

Netgear Readynas NV+

Netgear Readynas NV+

But it can be loaded with up to 4 2TB discs, bringing its total capacity to 6TB with data redundancy to help protect from disk failure.
AND it has embedded streaming support.
So I can offload my media collection to my nas and play it from anywhere in the house: the net connected TV, my laptop obviously, but also my phone! Nifty!

And here I learned something.
This whole “streaming” shebang that goes all the rage these days, in its home incarnation is based on a commercial arrangement called DLNA. This is a modification of an already existing protocol, to allow different devices to interact and exchange multimedia data over a network.

The basic principle below is broadcasting on the network the existence of the streaming server.
And here all the theory fails: I read some forums, articles, blogs, and did my own tests, confirming inevitably that, should your wireless gear (Access Point, router, whatever) be older then some point unknown, you can’t swim in streamed music over wireless.

The broadcast messages needed for the streaming to work are simply ignored by wireless stations.
Bot my ADSL modem/router with integrated access point, and an el-cheapo access point that has served me for 4 years and still would if I needed it to, don’t work.
While a newer WIFI N access point (D-LINK DAP 2553) doesn’t have any problem.

So my phone can’t see the multimedia server, because it uses the old wireless, while my laptop can because it uses the new N wireless.
And I’m not joking!
I’ve stared for hours at the packet sniffer, hopping from one net to the other, trying to understand what was going on: packets simply weren’t farwarded to the wireless network. At first I though in a problem derived from a configuration error, but the more I looked at it, the more I couldn’t find an error, nor a logic: everything else worked, even direct pinging, just the broadcast packets were nowhere to be found.
And more telling was that, when hooked from the N wireless, I could see the broadcast packets in answer to the phone requests, but when hooked on the standard wireless, I couldn’t see them.
So this was a confirmation that the packets were indeed sent, but that they were blocked at the frontier between wired and wireless.
And that meant that it was the AP blocking them.
So I took out from storage the old standalone AP (before I got the new integrated modem/router/ap) and it showed the same behaviour.

My final take is that, somehow, older devices don’t correctly forward certain types of packets, most notably those now used by streaming protocols.
This in turn means that, should I really want to have wireless streaming, I should search for a new device probably labeled as “multimedia” or “AV”.



Posted by: Claudio Carbone | 17 July 2011

Finally something techy!

Hi guys!

Finally I can write about something really related to technology and stuff.
A couple weeks ago, I was searching for a Bluetooth embedded module that supported HID (Human Interface Device), a protocol widespread in all ambients (Windows, Mac, Linux) to support many kinds of peripherals: from mice and keyboards to complex custom acquisition cards.
Sadly it hasn’t arrived yet, so I can’t show you that, but while browsing a kind of “social engineering” site called InMojo (give it a look, it’s full of interesting projects and boards!) I stumbled upon a little nifty circuit: an automatic charger/power supply designed to output power on a USB-A plug, while simultaneously charging a Lithium cell, harnessing the power of the sun

So I immediately ordered a circuit and two solar panels, and for 24$ shipped, I’d say it’s nice and cheap enough!

Solar panels just unboxed!

Now my idea of the project is to build a 2-axis sun tracker powered with two RC servomotors, everything controlled by a pic with an RTC, and powered by the very same panels with attached Inmojo circuit and a Lipo/Liion battery.
But, how to track the sun?
I figured out that a resistor bridge made of photo-resistors would do the trick.

The sun tracking module

The sun tracking module

Here you can see a board from another project with a PIC 18F4553 running at 48MHz side by side with 2/3rds of the sun tracking module.
The “M” like shape above is made of two diodes (to clamp the voltage) and two 1% resistors: these provide the reference voltage to compare to determine when the sun is aligned and when it is not.
Below that are 4 photo-resistors connected in pairs to the clamping diodes.

The basic idea is to cover this with a pin-hole like dark room made of black cardboard.
When this is exposed to light, a circular lighted area is projected on the inside, following the geometrical line connecting the hole and the sun. So putting these 4 sensors below the pin-hole, the only condition in which the different sensors would read the same light value would be with the sun straight ahead! Any misalignment yields an imbalance in the center-tap voltage. This then is used by the pic to drive the motors.

Sun tracking module detail

Sun tracking module detail

I’m still far from showing anything more meaningfull then this, but hopefully in the coming weeks I’ll be able to show some more work in progress.


Posted by: Claudio Carbone | 29 June 2011

Where Internet is the new golden infrastructure



Follow this Engadget inquiry into the Broadband state across the ocean.

They lament the US Feds don’t do enough to spread open their market, like Europe did with Unbundling.

That’s an economic/financial contract to allow the former market dominants (usually the big old companies that inherited all the landlines) to lend their lines to different service providers.
That way material propriety of the cable remains the same, but any provider can use any cable to bring its service to the customers, just by paying transit fees.

This is in essence why that’s so good: it doesn’t force a company out of the market (the old dominant) but puts a wedge in its lock and allows other entities to enter the same market by piggybacking for a cost.
Marvelously smart!
We have it in Italy too, still there is practicly no constract below 20€, and we just have two tiers:

20€ – internet + phone (paid for each call)
40€ – internet + phone (all inclusive)

Average speed is 8 MBits / 0.5 Mbits
Maximum speed is 20 Mbits (best effort, if signal is good enough) / 1 MBits

There is no market choice for quality, or upload speed, or time-of-day, or gaming.
More then 10 operators, for 60 million people, offer the same 2 constracts for the same 2 prices.

In the video you can see UK Ads campaign for commercial services down to less then 4£ a month! (minute 1:39 in the video)
In Italy the cable lending fees are ruled by the Autorità per le Garanzie nelle Comunicazioni.
The last ruling was in December 2010, and issued a prompt reply from the EU stating those prices were not good.
In fact AGCOM forcefully raised lending fees to these levels

  • 2010 8.70 €
  • 2011 9.02 €
  • 2012 9.28 €

That’s money that gets directly shifted onto the end user monthly fees.
So to confront UK and Italy: in Italy a contract that goes for 3.49 € like in UK, HAS TO PAY the incumbent another 5.53 € !!!
Meaning no one could ever offer anything below 10€ by legal ruling! And even that low would be insane.
Now think about this: more then 9€/month (PER LINE!) to justify maintenance on a landline.

Am I the only one doubting the amount?

Posted by: Claudio Carbone | 22 June 2011

A never seen before Napolitano!

A satyric personification of the President of the Italian Republic Giorgio Napolitano by the renown comic Maurizio Crozza.

If you don’t speak italian well… try to get it anyway, it’s really a masterpiece!

Posted by: Claudio Carbone | 9 June 2011

The mother of all Vacuum Cleaners!

Nuff said folks!

« Newer Posts - Older Posts »