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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: