Monthly Archives: April 2013

Symfony2, Assetic, Twitter Bootstrap + Bootswatch

This is a quick’n’dirty guide for newcomers to symfony’s assetic and twitter bootstrap in conjunction with bootswatch. This is not a complete guide and reflects my own opinion only.

Quick terms:

  • Assetic is automated asset management and compilation, in this example it’s used to compile less files
  • less is used to compile a templateish CSS language into real CSS files your browser understands
  • Your advantages:
    • Easy color changes
    • One command to update your css
  • First, install nodejs. 
  • Configure bootstrap and jquery packages:

 

  • Add the following block to your config.yml and change the paths as explained in the comments.

 

  • Create a new build.less file and add the following stuff:

  •  Choose your favourite theme at bootswatch.com and download both .less files per theme. Place them alongside in the same directory where you placed your build.less file.

Now you can run app/console assetic:dump to compile the less file into a css file, which you then can include using the usual twig fragment:

That’s it. If you’re getting any errors, I’m sorry: You need to find out yourself what’s going on. I’ve spend 3 hours to get the initial setup running. Guides I’ve followed or files I’ve looked at:

  • http://bootstrap.braincrafted.com/getting-started (I’m not using the bootstrap bundle, as I don’t currently see the need for it. This might change as soon as I’m using KnpPaginator, KnpMenu and symfony forms. I just left the bundle out because I had trouble getting it to work, the reason was that my nodejs setup was forked up).
  • The build scripts for bootswatch
  • The source for the Assetic Less filter (no, you can’t inject different less imports, hence the build.less encapsulation script above)

 

Autonomous WLAN Router Experiment: Part 1

I’ve been wanting to build an autonomous WLAN router for quite some time. That WLAN router should be powered by a solar cell and a battery. I have spoken about the TL-WR702N at RaumZeitLabor a while ago, and it is very small, draws 150mA max and is therefore suitable for such a project.

Some time has passed, and yesterday Doozer gave two Lead–acid batteries to me, rated 12V 5Ah each. So now I have to do this project!

I’ll use one battery for the project. I have made the following assumptions:

Ed: Average daily electricity production (kWh)
Em: Average monthly electricity production (kWh)

  • The router will permanently draw 150mA at 5V, or 0.75W (worst-case)
  • The solar charger circuit will have a power requirement of 15mA at 12V (0.075W)
  • The DC-DC converter I’ll be using has an efficiency of 80% (worst-case assumption, will probably be much higher)
  • To be on the safe side, all further calculations assume that our overall power usage is 2W
  • Overall yearly power: ~18kWh, 1.5kWh per month
  • Using the interactive photovoltanic calculator (linked below) I was able to calculate that a 20Wp cell is not sufficient from October till February.
  • As we assumed the worst-case scenario, and this is an experiment only, I decided to go with two 20W panels, where I’ll experiment with one panel, then two if it’s not sufficient.

I now have to buy the solar panels and the charge controller, which I’ll do in may.

Useful resources: