Sunday, 3 February 2013
Raspberry Pi Server improvements
Now, it dawned on me last week (luckily after only 3 hours) that I was writing a small file out to the SD card every 5 seconds from my Python program which might be hard on the SD card with all those writes. SD cards and Linux file systems provide some sort of wear levelling, but any application which writes intensively to the card is going to wear it out fairly quickly. Writing to the card every 5 seconds might wear it out in a few weeks at best.
The other one was to use PHP to send data directly to the client browser using AJAX without an intermediate Pyhon script and file writes. I got this working this afternoon, but without proper data as I need to research using I2C on the RaspberryPi with PHP, if this is even possible. Using dummy data provided by PHP random number statements the results are good and over the local wireless lan refreshes of at least 4 per second (delay of 250 ms) are possible. The photo below shows the graph displayed on a basic Android 2.3 tablet I have which is in need of a purpose. I could see this mounted on the dashboard of the MR2 with the Raspberry Pi in AP (access point) mode, serving data via wireless from the engine.