eList
The concept is the device sits on the charger and receives entries to the list using a wireless solution.
Entries can be added or subtracted using a web server application, that formats and transmits the list contents to the eLIST.
see the previous posts Beyond the Phone - eLIST progress 4 (Transmitter modifications) Beyond the Phone - eLIST progress 3 eLIST progress 2 , eLIST progress , eLIST - KOBO Touch , 5W Load Schematic
Webserver
I'm using a Raspberry Pi as the webserver for this application.
It connects to the Wireless Charging Transmitter to detect when the eLIST is present, and changes the home page accordingly.
It's been an interesting Challenge, as I wanted to minimize the 'add-ons' to both the eLIST device and the RPi, which meant a mixture of html and php to do what I wanted.
This has been the most frustrating and time consuming part of the exercise, but I have learnt a lot (apart from my coding skills suck).
I intend to detail the complete setup of the RPi, but not tonight as I have other things to sort out for something not related to this project.
I also wanted to start with a fresh install, as I have loaded a few things I think aren't necessary.
The index page is a simple menu with the messages showing.
Its been optimized to fit the KOBO screen, so is a little small on the big screen.
The index.php script is
<html> <head> <META http-equiv="REFRESH" content="5; url=index.php"> <title>Welcome to eLIST</title> </head> <body> <h2><strong>Welcome to eLIST</strong></h2> What would you like to do ?<br> <hr> <small>Leave a message </small><a href="Message.php"> Messages </a>.<small> Show List </small><a href="ShopList.php">List </a>. <br> <hr> <?php for($i=1; $i < 5; $i++) { $f = 'Message' . $i . '.txt'; if (file_exists($f)) { print '<small>' . ' Message ' . $i . ' contents ' . ' </small>' . '<br>'; print '<textarea readonly rows="2" cols="30">'; $file = fopen($f, "r"); while(!feof($file)) { $filetext = fgets($file); print $filetext; } fclose($file); print '</textarea>'; print '<br>'; } } ?> <img src="/images/element14logo.jpg" alt="element14" width="180" height="46"> <img src="/images/ti_logo_jan31.gif" alt="Texas Instruments" width="123" height="31"> <img src="/images/we_logo_jan31.gif" alt="Wurth" width="68" height="31"> </body> </html>
If you choose to add or change a Message, the link takes you to Message.php
The message creation script is another php that caused me grief due its peculiar methods and my lack of skills.
I finally resorted to dealing with it as 4 files, and repeating the script. (not elegant but functional)
<h3>This allows you to enter and store a message for the eLIST screen.</h3> <hr> <P> <h4><strong>Enter your message</strong></h4> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <strong> Message 1 </strong><p> <?php $f = 'Message1.txt'; if (file_exists($f)) { print '<TEXTAREA name="Message1text" rows="3" cols="40">'; $file = fopen($f, "r"); while(!feof($file)) { $filetext = fgets($file); $Message1text = $filetext; echo $Message1text; } fclose($file); print '</textarea><br>'; } ?> <input type ="submit" name = "Message1" value ="send"> your message.<br> <hr> <strong> Message 2 </strong><p> <?php $f = 'Message2.txt'; if (file_exists($f)) { print '<TEXTAREA name="Message2text" rows="3" cols="40">'; $file = fopen($f, "r"); while(!feof($file)) { $filetext = fgets($file); $Message2text = $filetext; echo $Message2text; } fclose($file); print '</textarea><br>'; } ?> <input type ="submit" name = "Message2" value ="send"> your message.<br> <hr> <strong> Message 3 </strong><p> <?php $f = 'Message3.txt'; if (file_exists($f)) { print '<TEXTAREA name="Message3text" rows="3" cols="40">'; $file = fopen($f, "r"); while(!feof($file)) { $filetext = fgets($file); $Message3text = $filetext; echo $Message3text; } fclose($file); print '</textarea><br>'; } ?> <input type ="submit" name = "Message3" value ="send"> your message.<br> <hr> <strong> Message 4 </strong><p> <?php $f = 'Message4.txt'; if (file_exists($f)) { print '<TEXTAREA name="Message4text" rows="3" cols="40">'; $file = fopen($f, "r"); while(!feof($file)) { $filetext = fgets($file); $Message4text = $filetext; echo $Message4text; } fclose($file); print '</textarea><br>'; } ?> <input type ="submit" name = "Message4" value ="send"> your message.<br> <hr> <?PHP if(isset($_POST['Message1'])) { $MessageText = $_POST['Message1text']; $file = fopen("Message1.txt","w"); $fileokay = fwrite($file,$MessageText); fclose($file); if ($fileokay != false) { $page = $_SERVER['PHP_SELF']; echo '<meta http-equiv="Refresh" content="0;' . $page . '">'; } } if(isset($_POST['Message2'])) { $MessageText = $_POST['Message2text']; $file = fopen("Message2.txt","w"); $fileokay = fwrite($file,$MessageText); fclose($file); if ($fileokay != false) { $page = $_SERVER['PHP_SELF']; echo '<meta http-equiv="Refresh" content="0;' . $page . '">'; } } if(isset($_POST['Message3'])) { $MessageText = $_POST['Message3text']; $file = fopen("Message3.txt","w"); $fileokay = fwrite($file,$MessageText); fclose($file); if ($fileokay != false) { $page = $_SERVER['PHP_SELF']; echo '<meta http-equiv="Refresh" content="0;' . $page . '">'; } } if(isset($_POST['Message4'])) { $MessageText = $_POST['Message4text']; $file = fopen("Message4.txt","w"); $fileokay = fwrite($file,$MessageText); fclose($file); if ($fileokay != false) { $page = $_SERVER['PHP_SELF']; echo '<meta http-equiv="Refresh" content="0;' . $page . '">'; } } ?> </form> <p> <p> <br> </body> </html>
If you choose to alter the Shopping List
It runs the ShopList.php script, which pulls the data from Choice.txt.
This is a simple text file with a comma separator and 0 or 1 for items with a check against them.
The idea was you could arrange it in any order, and add items to it manually. ( I didn't have time to do something fancy for adding items ...)
Bread,0
Milk Green,1
Milk Blue,0
Marg,1
Ham,0
Cheese,0
Biscuits,0
Rasp Jam,0
Marmalade,0
Honey,1
Apples,1
Bananas,1
Minion Beer,1
The script numbers the entries and presents it in a simple form that allows you to click on the checkbox or the text.
Once you press Send, the form refreshes and shows the contents (mainly while I was putting this together), and writes the choices back to Choice.txt.
It then reloads the page after 2 seconds.
<p> <hr> <h4>Show contents of Choice.txt</h4> <hr> <table style="width:300px"> <head> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> </head> <?PHP $file_handle = fopen("Choice.txt", "rb"); $ListCount = 1; $Choice = array(); while (!feof($file_handle) ) { $lineA = fgets($file_handle); $partAa = explode(',', $lineA,2); if (strlen($partAa[0]>"1")) { $checktext = $partAa[0]; print '<tr>'; if ($partAa[1]==1) { print '<td>' . $ListCount . '</td> <td> <input type="checkbox" name="List[]" value= "' . $partAa[0] . '" id = "' . $partAa[0] . '" checked ="1" ><label for= "' . $partAa[0] . '"> ' . $partAa[0] .'</label></td>'; } else { print '<td>' . $ListCount . '</td> <td> <input type="checkbox" name="List[]" value="' . $partAa[0] . '" id = "' . $partAa[0] . '"><label for= "' . $partAa[0] . '"> ' . $partAa[0] .'</label></td>'; } print '</tr>'; $Choice[$ListCount] = $partAa[0]; ++$ListCount; } } fclose($file_handle); print '</table> <p> <p>'; print '<input type="submit" name= "formSubmit" value="Send">'; print '<input type="submit" name= "formCancel" value="Cancel"> <br>'; print '</form>'; print '<hr>'; if(isset($_POST['formSubmit'])) { $Entry = $_POST['List']; if(empty($Entry)) { echo ("<p>The eLIST is empty.</p>\n"); } else { $N = count($Entry); echo("<p>The eLIST has $N entries: <br>"); for($i=0; $i < $N; $i++) { echo ("$Entry[$i] <br>"); } echo("</p>"); } $file_handle = fopen("Choice.txt", "w"); for($i=1; $i <$ListCount; $i++) { $txt = $Choice[$i] . "," . "0\n"; for($j=0; $j < $N; $j++) { if ($Choice[$i] == $Entry[$j]) { $txt = $Choice[$i] . "," . "1\n"; } } fwrite($file_handle, $txt); echo $txt; echo ('<br>'); } fclose($file_handle); print '<META http-equiv="REFRESH" content="2; url=ShopList.php">'; } ?> <br> <hr> </body> </html>
These processes are all on the server side, and the intention was you would interact with any device, but the pages have been designed to allow the KOBO to also interact.
For the eLIST page, I presented a page that simply showed the checked content of Choice.txt with the checkboxes unticked.
The script eLIST.php presents it, so again any device could be used to uplift the file from the webserver.
<p> <h4>eLIST</h4> <hr> <?PHP $file_handle = fopen("Choice.txt", "rb"); $ListCount = 1; while (!feof($file_handle) ) { $lineA = fgets($file_handle); $partAa = explode(',', $lineA,2); if (strlen($partAa[0]>"1")) { if ($partAa[1]==1) { print '<input type="checkbox" name="List[]" value= "' . $partAa[0] . '" id = "' . $partAa[0] . '" ><label for= "' . $partAa[0] . '"> ' . $partAa[0] .'</label> <br>'; } ++$ListCount; } } fclose($file_handle); print '</form>'; ?> <br> </body> </html>
Because the KOBO can't use the Web Browser to open a file on its own storage, it needs to pick it up from the server.
However once it has that file, you can drop the wireless connection and put it to sleep, and it will still behave as if you are online.
This means you can tick the items on the eLIST as you put them in the trolley.
Conclusions
This has been a very interesting challenge, and I'm pleased I was chosen to take part.
I have a few things to complete :-
- Detection of charging on the webserver.
- Changing the Index page if the eLIST device is not on the charger
- Change the charging receiver for the Wurth slim version (it hasn't arrived)
- Build the stand (when the receiver arrives)
- Sort out a means to add entries via the webserver.
Once again I want to thank the sponsors Wurth, Texas Instruments and element14
Because its really, really late this will be the last blog before the competition closes (today).
If you wish to vote the poll is here but not open for long Community Choice - Beyond the Phone Challenge
edit Pictures are here Beyond the Phone - eLIST progress 6 - pictures
cheers
Mark Beckett
edit 01/07/14 missing " in the eLIST.php script which prevented the word from being selected to change the checkbox.