Thursday, September 12, 2013

Solar Tracker in the Internet Cloud

The major system components identified in the block diagram:
90 Watt solar Panel Two axis motion platform constructed from 2x4’s complete with wooden peg gears and re-used curtain rod/pole. Custom electronics – Electric Imp connected to stepper drivers, IO Expander and 6 Axis MEMS accelerometer/magnetometer Rechargeable battery – retired unit from my motorcycle as it is no longer capable of turning the engine over. Solar Charge Controller – cheap unit from ebay to make sure the battery doesn’t overcharge. Smartphone or web browser – monitoring status and remote control. This is a non-essential part of the system done purely for a learning experience to see what it takes to connect a phone to a remote device. (gotta remember to hide the URL so that I don’t have too many people trying to control the panel!) The tracker circuit includes a tilt compensated compass - the math was coded from an application note. The chip has 3 axis magnetic output and 3 axis accelerometer output. The magnetic output tells the system the azimuth angle and the accelerometer tells the system the the inclination with respect to gravity. The GPS location is hardcoded in the firmware (future will have this set by smartphone via the web). The firmware determines based on the time of day and geographic co-ordinates what the sun angle is with a Sun Angle algorithm ported to the Electric Imp Squirrel language from C++ (discussed in later steps). Firmware drives the azimuth and elevation motors to the Sun Angles based on feedback from the mag/accel. 

This whole thing could be done a lot more simply, but I saw a personal learning opportunity with contemporary web development techniques and was intrigued by the Internet Of Things made possible by the Electric Imp. Rather than just randomly reading web articles to get a superficial understanding, I immersed myself in the technology to come up with an most likely an overkill solution to a common problem. Most solutions on the market today are "light followers". They control motors in response to the intensity of light to maximize incident sunlight on the panel. These work well, are low cost and are really all you need. But, you will not learned any of the following on the electronics/firmware/web development side:

1. ASP.NET programming model for web based applications. This is the server side code that the smartphone connects to, to see the status of the system, or to drive inputs to the controller for manual control of azimuth and elevation for debugging purposes.

2. AJAX which allows a web page to update without server page reload. Allows a web page to dynamically query server data directly and update the regions of the page without page reload. This is how the monitoring data is updated.

3. SQL Server work on the back end. The data from the Electric Imp is logged in a SQL Server database. There was a time when writing SQL queries was second nature.... not so much anymore!

4. JQUERY Mobile - great open source library that simplifies working with the Web page Document Object Model. Just scratching the surface of it but it has taken the web by storm. It is a great way to develop Smartphone HTML5 "apps".

5. HTML5 capabilities and the relation to potential hardware independent phone apps. Bumped into a number of apps that will take the Web app and turn it into a traditional phone store application. Some are free until you reach 10000 downloads... yeah right!

6. The Internet Of Things model and what companies like Electric Imp and COSM are doing to make this a reality even for low budget hackers like me.

7. Appreciation of cloud based services and the power of having services provided by the cloud. The electric imp is fully cloud
based....  your firmware lives in the cloud and is downloaded when your device connects to the internet.

8. Algorithms for tilt compensating a compass.. Ultimately I implemented an app note but it was a major journey of "discovery" for
me.

9. Algorithms for sun angle prediction. Ported an Open Source implementation to the Electric Imp. Had no idea that this was such a complex problem. I don't fully understand the algorithm but tip my hat to anyone who does! IJW!

10. I2C hardware communication and associated peripherals - as long as I have been messing with electronics, never controlled an I2C peripheral before.

I'm sure I learned plenty more but I capped the list at 10!

I think the easiest way to tackle this documentation is to walk you through the building of the tracking base, then the electronics/firmware and finally the web app. The electronics and motion platform are independent components of the system. The tracker electronic module was designed to be a reusable component. The tracker base was designed to demonstrate peg gears and levers in another shameless attempt at stimulating my kids’ minds with engineering. A future weatherproof design using more 21st century motion mechanism is in the design phase and will be built over the course of the next year or so. I would like to offer that as complete package to interested consumers. 

OK, let's get started. 


View the original article here

No comments:

Post a Comment