Tag Archive: Enigma2


Home Automation Update

Not a lot to say- just a quick update. I’ve ordered a few more bits to add to the home automation project. These have already come:

-RFXCom 433Mhz transceiver
-Byron 433Mhz switch, pir, remote plug/socket & "in ceiling switching module".
-Linksys SPA3102

And I’m still waiting for (or haven’t ordered):

-433Mhz smoke alarms
-433Mhz doorbell
-433Mhz door/window open/close sensors
-Wifi or 433Mhz bathroom scales

Here’s a quick shot of one of the raspberry pis hooked into a little portable LCD, the RFXCOM transceiver, the CurrentCost EnviR and a Jeelabs Jeenode:

The next step I decided to tackle was getting a few real basics pieces of information from my Enigma2 digital satellite receiver into DomitiGa. I decided to use the nifty little shell script module to execute:

#!/bin/bash
rm current
wget -q http://192.168.0.222/ajax/current
cat current | grep "Name:" | sed 's/.*: (.*)<.*/1/'
cat current | grep "Title:" | sed 's/.*: (.*)<.*/1/'
cat current | grep "Recording Status:" | sed 's/.*: (.*)<.*/1/'

Which returns three lines with: The current channel, programme and whether a recording is in progress. I hope to take this a lot further and start capturing stats from my VDSL & ADSL modems, fileserver etc. You can see the satellite details below "Sky: Lounge":

I have been meaning to get my gas meter, hot & cold water monitored for a long time. The gas meter is relatively straight forward as it provides a convenient RJ11 socket with pulses- I just needed a sketch to load onto a jeenode to catch and report these pulses. I decided to try the sketch from the OpenEnergyMonitor project (http://openenergymonitor.org/emon/emontx) found here: https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTx_Pulse

I made some changes:

-Set freq to 868Mhz
-Set nodeID and networkGroup
-Unset UNO

I think that’s it:

/*
EmonTx Pulse example

An example sketch for the emontx module for
CT only electricity monitoring.

Part of the openenergymonitor.org project
Licence: GNU GPL V3

Authors: Glyn Hudson, Trystan Lea
Builds upon JeeLabs RF12 library and Arduino

*/

#define freq RF12_868MHZ // Frequency of RF12B module can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. You should use the one matching the module you have.433MHZ, RF12_868MHZ or RF12_915MHZ. You should use the one matching the module you have.
const int nodeID = 2; // emonTx RFM12B node ID
const int networkGroup = 212; // emonTx RFM12B wireless network group - needs to be same as emonBase and emonGLCD needs to be same as emonBase and emonGLCD

const int UNO = 0; // Set to 0 if your not using the UNO bootloader (i.e using Duemilanove) - All Atmega's shipped from OpenEnergyMonitor come with Arduino Uno bootloader
#include <avr/wdt.h> // the UNO bootloader

#include <JeeLib.h> // Download JeeLib: http://github.com/jcw/jeelib
ISR(WDT_vect) { Sleepy::watchdogEvent(); }

typedef struct { int power, pulse, misc1, misc2; } PayloadTX;
PayloadTX emontx; // neat way of packaging data for RF comms

const int LEDpin = 9;

// Pulse counting settings
long pulseCount = 0; // Number of pulses, used to measure energy.
unsigned long pulseTime,lastTime; // Used to measure power.
double power, elapsedWh; // power and energy
int ppwh = 1; // 1000 pulses/kwh = 1 pulse per wh - Number of pulses per wh - found or set on the meter.

void setup()
{
Serial.begin(57600);
Serial.println("emonTX Pulse example");

rf12_initialize(nodeID, freq, networkGroup); // initialize RF
rf12_sleep(RF12_SLEEP);

pinMode(LEDpin, OUTPUT); // Setup indicator LED
digitalWrite(LEDpin, HIGH);

attachInterrupt(1, onPulse, FALLING); // KWH interrupt attached to IRQ 1 = pin3 - hardwired to emonTx pulse jackplug. For connections see: http://openenergymonitor.org/emon/node/208

if (UNO) wdt_enable(WDTO_8S);
}

void loop()
{
emontx.pulse = pulseCount;
pulseCount = 0;
//Serial.println(pulseCount);
send_rf_data(); // *SEND RF DATA* - see emontx_lib
emontx_sleep(10); // sleep or delay in seconds - see emontx_lib
digitalWrite(LEDpin, HIGH); delay(2); digitalWrite(LEDpin, LOW); // flash LED
}

// The interrupt routine - runs each time a falling edge of a pulse is detected
void onPulse()
{
lastTime = pulseTime; //used to measure time between pulses.
pulseTime = micros();
pulseCount++; //pulseCounter
//Serial.println("Pulse!");
emontx.power = int((3600000000.0 / (pulseTime - lastTime))/ppwh); //Calculate power
}

void send_rf_data()
{
rf12_sleep(RF12_WAKEUP);
// if ready to send + exit loop if it gets stuck as it seems too
int i = 0; while (!rf12_canSend() && i<10) {rf12_recvDone(); i++;}
rf12_sendStart(0, &emontx, sizeof emontx);
// set the sync mode to 2 if the fuses are still the Arduino default
// mode 3 (full powerdown) can only be used with 258 CK startup fuses
rf12_sendWait(2);
rf12_sleep(RF12_SLEEP);
}

void emontx_sleep(int seconds) {
for (int i=0; i<seconds; i++) {
delay(1000);
if (UNO) wdt_reset();
}
}

L

Advertisements

More Home Automation Chat

I’m away from home at the moment so not much to report. I’ve not had a chance to install the water meters with my friend yet nor connect the gas meter to the hah but I have taken delivery of a bunch more jeenodes and room plugs:

Starting to put one together:

I now have 3 nodes collection temperature, light and humidity data and posting to pachube along with my total household power consumption and appliance level detail for 6 devices:

Whole house power consumption:

An example of individual device consumption (this happens to be the boiler):

Room data:

I’ve tried to create a "naming convention" where the data stream id contains the nodeid (first digit) followed by 1 for temperature, 2 for light and 3 for humidy.

You can quite clearly see where the temperature rises in line with the boiler coming on. You can also see the light pattern during the day (wow- it’s getting dark real early!!!). Humidity isn’t really of much interest.

Interestingly I think node 2 is in the same room as the receiver/hahcentral/hub but seems to drop out every few hours. Node 3 in the room next door is rock solid. And node 5 in the room next to that is extremely flakey! Brett from over at hah has suggested lengthening the antenna on the nodes to resolve these issues- I will do some experiments when I have a little more time on my hands :)

And one final note- whilst on the topic of "home automation". I have replaced my sky boxes in recent months with the Clarke Tech ET9000: https://tickett.wordpress.com/2011/09/20/getting-started-with-clarke-tech-xtrend-et9000-and-sky-hd-uk/ and pipe the picture round the house from these and my home theatre pc (htpc) running xbmc with a cheap 4×4 HDMI matrix I picked up off eBay. I now have full control over these devices from my mobile phone (iPhone):

DreaMote Lite (for Enigma2 satellite receivers):

And XBMoteC (for XBMC):

All slow, but steady progress toward a completely integrated/automated home!

L

Roughly a week after installing my 2nd ET9000 I powered on the box to be presented with a blank green screen with a spinning Vix logo in the top left hand corner (the VFD was stuck at “booting…”).

Fortunately I was able to SSH into the box and access the crash log:

IOError: [Errno 28] No space left on device: '/usr/share/enigma2/ViX_HD/skin.xml.tmp'
---- saving lame channel db
FATAL: couldn't save lame channel db!
]]>
</enigma2crashlog>
</crashlogs>
</openvix>

There were hundreds of crash logs with date/time stamps just minutes apart (suggesting the box was stuck looping through the boot routine). Each of the logs had a number of entries suggesting the root cause was a full disk.

df -h confirmed this to be the case:

Filesystem Size Used Available Use% Mounted on
/dev/root 122.0M 121.5M 552.0K 100% /
tmpfs 64.0K 8.0K 56.0K 13% /dev
/dev/sda2 15.4G 67.4M 15.3G 0% /media/usb
tmpfs 155.4M 804.0K 154.6M 1% /var/volatile
tmpfs 155.4M 0 155.4M 0% /dev/shm

But why was /dev/root full when my recordings/crash logs are all stored in /media/hdd which points to /media/net/tv?

I ran a ton of linux commands to try and identify large files/directories but nothing stood out- I was almost ready to re-flash the Vix firmware, then a had a brainwave…

If at some point the box had been unable to mount /media/net/tv (I had suffered a power cut recently) then where would recordings & crash logs be kept? Again- I couldn’t find the location anywhere, so I thought I’d force it…

I took the samba share offline and restarted the box- voila! /media/hdd was mounted but this time I couldn’t see the normal recordings and crash logs- just a single recording…

I ran rm * then df –h

/dev/root 122.0M 60.2M 61.8M 49% /
tmpfs 64.0K 8.0K 56.0K 13% /dev
tmpfs 155.4M 688.0K 154.7M 0% /var/volatile
tmpfs 155.4M 0 155.4M 0% /dev/shm

The ET9000 flash had 51% free space again! I placed the samba share back online, rebooted the box and everything is back to normal.

Thanks to the community @ http://www.world-of-satellite.com/showthread.php?11385-New-ET9000-Disk-Full&p=82840#post82840 for helping me troubleshoot/solve the problem!

L

Getting on really well with the AB IPBox 9900HD but feel I need something with a bit more grunt (and a bit more community support). I looking to order the Vu+ Duo or Clarke-Tech ET9000 (or potentially both) and play around with the latest ViX team image.

I will also need to order a new octo LNB and some more ccable for my dish so I can have all these boxes hooked up at the sametime :)

I’m a little tempted to try building my own linux pvr (using something like the acer revo r3610 which I’m currently using for xbmc) with a usb twin dvb-s2 tuner. Not only should this have a lot more power, it will be a lot smaller and save me using two separate devices for pvr + htpc!

L

Further to my earlier post getting the AB IPBox 900HD up and running with Sky+ HD: https://tickett.wordpress.com/2011/06/23/ab-ipbox-9900hd-with-sky-hd-uk/

I had a bit of trouble initializing a large HDD (320GB worked… 1.5TB didn’t) so here’s the workaround:

Telnet into the box and issue the following commands (make sure you replace the /dev/sda if fdisk –l identifies your drive with a different path and 1400GB with a figure slightly smaller than the size of your disk):

fdisk –l
fdisk /dev/sda
d
n
p
1
enter
+1400GB
n
p
2
enter
enter
w
mkswap /dev/sda2
swapon /dev/sda2
mkfs.ext3 /dev/sda1
reboot

The mkfs.ext3 command formats the disk and will take quite a while on larger disks (there may be a quick format option but I wasn’t in a hurry)

Once the box has rebooted your HDD will be mounted at /hdd – you need to make a folder /hdd/movies reboot again and you’re good to go!

L

I started identifying all twin tuner DVB-S2 enigma2 satellite receivers:

Then opted to buy the cheapest i could find- AB IPBox 9900HD for £200 on eBay. If i can see myself completely dropping the Amstrad DRX890 i may invest in one of the more expensive receivers.

It took quite some time to get the hang of it- i got through a number of firmware images before finally settling on the SWF 3.8 (found on http://www.sat-world-forum.com)- this seemed most stable and to provide the best plugin/extension/emu/cam abilities.

I ran a scan and picked up all 1000+ channels but could only view the free to air ones… seems i need to configure a softcam to use the sky viewing card. I tried all of them not really knowing what i was doing but eventually pieced together bits of various guides to get oscam working with the following configuration files:

# oscam.conf
#---
[global]
nice = -1
WaitForCards = 1
ClientTimeout = 5
CacheDelay = 120
logfile = /usr/local/etc/oscam.log

[dvbapi]
enabled = 1
au = 1
boxtype = ipbox
user = user
pmt_mode = 0
request_mode = 0

[webif]
httpport = 16002
httpuser = root
httppwd = swf
httprefresh = 10
httpallowed = 127.0.0.1,192.168.0.0-192.168.255.255
#---

# oscam.server
#---
[reader]
label = SkyUK
Protocol = internal
detect = CD
device = /dev/sci0
Group = 1
EMMCache = 1,3,2
#BoxID = 001F1F1F
CAID = 0963
ident = 0963:000000
#---

# oscam.client
#---
[account]
user = user
pwd = password
group = 1
au = SkyUK
CAID = 0963
#---

The HD channels didn’t work at first… but removing the BOXID=XXXXXXXX line from the oscam.server file fixed that!

Now i was ready to tidy up the channels- i found a bouquet on http://www.digital-kaos.co.uk (just search for sky uk channel bouquet. Then using DreamBoxEdit (http://sourceforge.net/projects/dreamboxedit/) open and upload to the IPBox (you will need to configure your box’s IP, ftp username/password in DreamBoxEdit- default username= root & password = swf)

The EPG wasn’t really showing a lot so i did a little research and it seems CrossEPG is recommended (available on http://crossepg.googlecode.com). It didn’t seem possible to download directly on the box so i ftp’ed it to /tmp and installed from the “setup -> software management -> install local extension” menu. After installation you need to reboot and can then access the CrossEPG setup menu- enable the OpenTV Sky UK (Astra2 on 28.2) provider and hit download. Your EPG should now be populated. I still don’t like the look of the EPG so need to do some more research!

Live TV can be streamed on the network easily using VLC media player and recorded programs can freely be moved around the network- love it!

Seemed to have a problem with network connectivity being lost a few times- restarting the network in the setup -> system -> network menu seemed to work but not too sure why it dropped yet…

L

%d bloggers like this: