Blog previously known as 'Home Theatre PC'

Reset Kiosk 0.6

  07/31/14 02:23, by Esa, Categories: Hardware

Another new version so soon after the previous.

- Utilizes Fullscreen API introduced in FF 10 to listen for transitions and adds option to enter back to fullscreen state whenever the browser leaves fullscreen.
- Adds option to enter fullscreen without navigation bar / tab bar (real presentation mode fullscreen) in FF 10+
- Adds option to prevent context menu from popping up on right mouse click, this works on all ff's.

https://addons.mozilla.org/en-US/firefox/addon/reset-kiosk/versions/0.6

Reset Kiosk 0.5

  07/27/14 14:53, by Esa, Categories: Hardware

Checked some reviews and feedback from users and made a few changes to the plugin.

New version uploaded

- Closes one tab at a time, no more 'closing multiple tabs' warning
- Adds options to clear browsing history, cache and cookies on reset

Available from addons.mozilla.org or via add-ons menu in firefox

Keräilyhaku, added another search section

  11/18/13 18:38, by Esa, Categories: Hardware

Added finnish design glass and ceramics to the search engine.

Keräilyhaku v2

  11/14/13 01:28, by Esa, Categories: Hardware

Seems it was a needed service, so it was moved to a separate domain. kerailyhaku.eu

Keräilyhakukone - combined search for finnish collectible coin selling sites

  11/10/13 17:02, by Esa, Categories: Hardware

It's been a while since I did anything that is actually worth publishing. I recently needed to find a few collectible coins and it was a pain in the *** to search all separate sites, let the images etc load, make notes to compare different sites etc. I thought it would be way faster to find the best prices for what I was looking for if I just made a little tool for it.

So this weekend project is now published:
http://www.viitalat.net/hakukone

It's all in finnish, but so are the webshops it searches from. The actual 'how to use the site' doesn't need much explaining (you've seen google right?). It's been tested of recent Safari, Chrome and Firefox on OSX Mavericks. Gotta get my hands on some windows machine to test recent IE as well . I don't have any plans on supporting ancient browsers (seriously, to those IE7 user agents - UPGRADE!).

Reset Kiosk 0.4

  08/16/11 22:14, by Esa, Categories: Software

Updated reset kiosk plugin to support Firefox 6.0.

It's being in queue for approval in the addons.mozilla.org.

Edit 5.10.2011: It took Mozilla 8 weeks to review the version and now there is already Firefox 7. ARGH! The manifest in the plugin says this is compatible only up to 6.0. But I marked this release compatible with up to Firefox 10.0a1 in addons.mozilla.org so you should be able to install it anyway. . .

4 comments »

1-wire temperatures with Arduino

  07/27/11 18:47, by Esa, Categories: Hardware, Software

I have used 1-wire temperature sensors (DS18S20) around my house for a few years now. Just recently the home made serial port adapter stopped working and I thought I'd look into replacing it with Arduino.

There was already 1-wire library and dallas temperature library available for Arduino under GPL license and wiring only required connecting data line to any of the digital io ports (I chose port 2) and 4k7 resistor between Arduino 5V and 1-wire bus data line for parasite power and grounding of course. Here's the code which reads the sensors and outputs to the usbserial.

#include <OneWire.h>
#include "DallasTemperature.h"

#define ONE_WIRE_BUS_DATA_PORT 3
#define LOOP_DELAY_1 30000 // max 32k...
#define LOOP_DELAY_2 30000
#define _NUM_SAMPLES 3
#define _SAMPLE_DELAY 1000

OneWire oneWire(ONE_WIRE_BUS_DATA_PORT);
DallasTemperature sensors(&oneWire);

void setup(void)
{
  Serial.begin(9600);
}

char* batoh(uint8_t deviceAddress[]) {
  char* buf_str = (char*) malloc(2*8 + 1);
  char* buf_ptr = buf_str;
  for (uint8_t i = 0; i < 8; i++) {
    buf_ptr += sprintf(buf_ptr, "%02X", deviceAddress[i]);
  }
  *(buf_ptr) = '\0';
  return buf_str;
}

float getTemp(uint8_t* addr, int samples, int delay_ms) {
  float sample[samples];
  float tmp;
  uint8_t l,i,j;
  for ( l = 0; l < samples; l++) {
    sensors.requestTemperaturesByAddress(addr); 
    sample[l] = sensors.getTempC(addr); 
    Serial.print("D "); 
    Serial.print(batoh(addr)); Serial.print(" "); 
    Serial.print(sample[l]); 
    Serial.println(" D");
    delay(delay_ms);
  }
  
  for ( i = 0; i < samples; i++ ) {
    for ( j = 1; j < (samples-i); j++ ) {
      if (sample[j-1] > sample[j]) {
        tmp = sample[j-1];
        sample[j-1]=sample[j];
        sample[j]=tmp;
      }
    }
  }
 
    
  return sample[samples/2];
}

void loop(void)
{ 
  uint8_t i;
  uint8_t addr[8];  
  uint8_t dcnt;
  
  sensors.begin();

  dcnt = sensors.getDeviceCount();
  //sensors.requestTemperatures();
  
  for ( i = 0; i < dcnt; i++ ) {
    sensors.getAddress(addr,i);
    float temp_c = getTemp(addr,_NUM_SAMPLES,_SAMPLE_DELAY);
    if (temp_c < -55.0 || temp_c > 125.0) { // range really -55 - +125, retry once if value returned is outside that range
      delay(_SAMPLE_DELAY);
      sensors.begin();
      temp_c = getTemp(addr,_NUM_SAMPLES,_SAMPLE_DELAY);
    } 
      Serial.print(batoh(addr));
      Serial.print(" ");
      Serial.println(temp_c);
  } 
  
  delay(LOOP_DELAY_1);
  delay(LOOP_DELAY_2);
}

Why read the same sensor several times? Because some of my sensors want to send either 85.00 or -127.00 every now and then once or twice in a row. Also sometimes I've been getting reading of the previous requested sensor when reading the next one. Reading 3 times and discarding the highest & lowest is not optimal, but it's good enough for me, for now. I had these same problems with the old, now broken, system using digitemp.

All the readings go to mysql database from which I create graphs with jpgraph library. I didn't want to include any date & time logic in the arduino part, so I'm reading the values from the serial port and inserting them to the db with 'current_timestamp'. I do that by reading the serial port constantly, with awk

awk '{ gsub("\\r",""); if (NF == 2) print "insert into temps (time_date,temp_c,sensor_serial) values (current_timestamp,\047"$2"\047,\047"$1"\047);"; fflush();}' /dev/cu.usbserial-A9007TRT | /opt/local/bin/mysql5 -u temps -pxxxxxx automation2

I use OSX for that, so I've made a little launchd script out of it (in linux the same can be done with inittab), it just makes sure the process keeps running.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.cue.onewire.temperatures</string>
    <key>RunAtLoad</key>
    <true/>
    <key>Umask</key>
    <integer>7</integer>
    <key>ProgramArguments</key>
    <array>
        <string>/opt/local/bin/storetemperatures.sh</string>
    </array>    
    <key>UserName</key>
    <string>esav</string>
</dict>
</plist>

Tell launchd to load your plist and you're done. Note that I've put the awk into a shell script because I didn't want to escape those parameters to plist &amp;#58;&amp;#41;

sudo launchctl load /Library/LaunchDaemons/your.own.plist

:: Next >>

Contents

Search

powered by b2evolution