aglasspool

Archive for 2010|Yearly archive page

Swimming Sets You Free

In Uncategorized on November 22, 2010 at 3:18 pm

This page is an attempt to promote rational debate on the question of whether the above concrete construction at Auschwitz concentration camp was a fire-brigade reservoir, as confirmed by the official story:

Or whether the fire-brigade reservoir story is just a cover-up and it was in fact a swimming pool for inmates as according to this video:

Now, the only facts we have so far are the photo of the pool and a photo of the plaque.

In order to enter into a rational debate on whether or not it was a swimming pool we would first need some facts disproving that it was indeed a reservoir.

Vim + Autocompletion

In Uncategorized on April 19, 2010 at 8:14 pm

The following pasted into your vimrc file will auto-complete on pressing tab.
It will offer you suggestions based on your current text first, then on dictionary entries.
I also had to enter this in my buffer:

:set complete-=k complete+=k

put this in vimrc:

“Use TAB to complete when typing words, else inserts TABs as usual.
“”Uses dictionary and source files to find matching words to complete.

“See help completion for source,
“Note: usual completion is on <C-n> but more trouble to press all the time.
“Never type the same word twice and maybe learn a new spellings!
“”Use the Linux dictionary when spelling is in doubt.
“Window users can copy the file to their machine.
function! Tab_Or_Complete()
if col(‘.’)>1 && strpart( getline(‘.’), col(‘.’)-2, 3 ) =~ ‘^\w’
return “\<C-N>”
else
return “\<Tab>”
endif
endfunction
:inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
set dictionary+=/usr/share/dict/words

Arduino + Electrisave/Cent-a-meter

In Uncategorized on March 29, 2010 at 6:00 pm

Trying to get Arduino to talk to an Electrisave energy consumption meter.

With an AC clamp, it is possible to measure the current traveling through a wire without physically touching it. Basically it is a simple transformer where the wire of interest acts as the primary coil and the AC clamp is the secondary coil. Most AC clamps are integrated into a multi-meter. It outputs 10mV per ampere and is intended to be connected to a multi-meter. All you do is multiply the voltage reading by 100 to get the current in the wire. This one is made by Steren, model MUL-285.

Here is a sample of the readings:

0
0
0
0
31
29
0
0
0
3
34
21
0
0
0
13
42
1
0
0
0
23
37
0
0
0
0
34
28
0
0
0
4
34
20
0
0
0
1

First question: Are these mv? Is it pumping out 10mv per ampere?

If so, all we need to do is times these by 100 to get the current.

But they are not consistent:

The readings come in groups of two or three positive integers surrounded by zeros. If we sum these groups of positive values we can see a pattern; the groups of integers which are preceded by four zeros are consistently higher than those preceded by only three zeros.

Okay, here is the code to convert the raw data into approximate MW consumption, and then post it to my Sinatra app hosted by heroku.com:

http://gist.github.com/547873

Arduino + Heatmiser via RS485

In Arduino on March 23, 2010 at 3:16 pm

I am trying to get my Arduino to talk to some Heatmiser Thermostats via rs485 and the Heatmiser Protocol.

I have got as far as purchasing a MAX485 rs485>rs232 converter and wiring it up as follows:

N.B.  The Heatmiser Thermostat is powered by an external 12v DC power source.

It comes with a blue cable and a yellow cable; these are the two data comms cables that we wire into the MAX485′s A & B pins.

The MAX485 has 8 pins:

  1. RO – Receiver out – Connected to Arduino Serial RX pin 0
  2. RE – Receiver enable (enabled when this pin is LOW) – Connected to Arduino Pin 7
  3. DE – Driver enable (enabled when this pin is HIGH) – Connected to Arduino Pin 7
  4. DI – Driver in (the transmitter pin) – Connected to Arduino Serial TX Pin 1
  5. GND – Connect to Arduino GND pin
  6. A – Connect to Yellow wire of the Thermostat
  7. B – Connect to Blue Wire of the Thermostat
  8. Vcc – Power, Connect to Arduino 5v pin

Now for the sketch:

// Arduino's Pin 7 Connected to Pins 2 & 3 (RE/DE) on MAX485
int switchPin = 7;
// Our Serial RX pin connected to RO- Receiver Output Pin on Max485- we receive on
#define rxPin 0
// Our Serial TX pin connected to DI- Driver Output Pin on Max485 - we send on
#define txPin 1

// here we insert the paramaters of our read request
byte req[]= {0x02, 0x04, 0x00, 0x06};

// for incoming serial data
byte incomingByte = 0;

void setup() {

  // opens serial port, sets data rate to 4800 bps(Heatmiser baud rate)
  Serial.begin(4800);
  //sets our Arduino's serial TX pin to send data
  pinMode(txPin, OUTPUT);
  //sets our Arduino's serial RX pin to receive data
  pinMode(rxPin, INPUT);

  // set the MAX485 to 'Driver Output Enable' by switching its pin 3 to HIGH
  digitalWrite(switchPin, HIGH);
  // send command string that requests the reading from the Heatmiser Thermostat
  Serial.write(req, 4);

  // set the MAX485 to 'Receiver Output Enable' by switching its pin 2 to LOW
  digitalWrite(switchPin, LOW);

}

void loop() {
	// kick in only when we receive data:
	if (Serial.available() > 0) {
		// read the incoming byte:
		incomingByte = Serial.read();

		// say what we got:
		Serial.println(incomingByte);
	}
}

According to the Heatmiser Protocol I need to initiate communications by sending a command string from the Master (Arduino) to the slave (Thermostat) before it will respond with the data I want to read from it.

Now all I need to do is figure out how to formulate this command string?

The Heatmiser Protocol instructions show an example for sending a command string as follows:

To query no.2 thermostat:

Send(Hex): 02H, 04H, 00H, 06H

The first unit(02H) is the address of the thermostat, the second(04H) is the request code asking the thermostat for its stats. I don’t know what the third one is so we will leave it as it is in the example. Finally, the last unit(06H) is the checksum of all the preceding units.

I have set my thermostat to use the Comms address 02 as in the example and am going to use the following code to send the command string listed in the example(02H, 04H, 00H, 06H) from the arduino to the thermostat:

byte req[]= {0×02, 0×04, 0×00, 0×06};

Serial.write(req, 4);

Alas, there is no reply from the thermostat. All i see on the serial monitor is this: [][][][]

Am I sending the correct values in the command string request?

The Heatmiser Thermostats are the vesion 2 protocol but the documentation for version 2 is sparse, and very different from the documentation for the version 3 protocol…

There is an example here on how to poll a version 3 thermostat for its readings:

The command to read back all the data from a PRT-N V3 set to address 01 is:- 01 0A 81 00 00 00 FF FF 2C 09

This is very different from the format specified in the example for the V. 2 protocol: 02H 04H 00H 06H

Confusing..

Am I sending these bytes correctly?

I have contacted Heatmiser to see if they could offer me any more documentation on the heatmiser protocol, but they haven’t been very helpful.

Damian suggested that I get my hands on an oscilloscope, and that you really need one of these in order to be able to debug RS485 comms. So I am looking out on ebay to see if I can pick one up cheapish..

Update 13th July 2010: I have decided to try and look for an alternative to Heatmiser. They have been unhelpful and their protocol is clearly not open. If anyone knows of a programmable thermostat that can be made to talk to an Arduino please let me know..


Pulseaudio Problems

In Uncategorized on February 26, 2010 at 6:04 pm

The first Steps of the following page got my audio working again after having upgraded to Karmic:

https://wiki.ubuntu.com/PulseAudio

Along with having added my username to the group.

Then open up:

sudo vim /etc/default/pulseaudio

and change the first option to 1 so that it runs as a system process

Install wmii on Ubuntu Jaunty 9.04

In Uncategorized on January 26, 2010 at 3:03 pm

1. Add the latest sources for the wmii development package from here:

https://launchpad.net/~maglione-k/+archive/ppa

sudo apt-get update

sudo apt-get install wmii

2. install rumai:

http://snk.tuxfamily.org/lib/rumai/

3. install sunaku’s wmiirc:

http://github.com/sunaku/wmiirc

4. create file “.xinitrc” in home folder:
#!/usr/bin/env bash
terminator &
exec wmii
5. logout, start bare terminal with Ctrl+Alt+F1, then kill gdm and startx with:
sudo /etc/init.d/gdm stop
sudo startx
6. You might need to change the permissions of users that are allowed to start x sessions with:

sudo dpkg-reconfigure x11-common

Configuring Wpa

In Uncategorized on January 20, 2010 at 11:32 pm

Using Wicd-curses
Download the latest deb package from:

http://downloads.wicd.net/pkgs/latest/

or with the command line:
create the file:

#/etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="MyAP"
#psk="secretpassword"
psk=27af0232e2382d3e01a14110642d974277d64eb6585fbcd1e5c2bed7b5b2887f
}

then in this order:
sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
sudo dhclient wlan0

Orange sms script

In Uncategorized on January 14, 2010 at 1:43 pm

This ruby script uses the mechanize gem to log in to Orange.co.uk’s website and send an sms message.

You will need ruby and the mechanize gem installed on your machine, and also an orange mobile phone account with associated registered login details for www.orange.co.uk.

To send a message using the script you will need to do the following from a terminal:

ruby path/to/orange.rb 07886999999 This is a test message

Where 07886999999 is the mobile number we are sending a message to, and whatever comes after that is the body of the message we are sending.

#orange.rb
#!/usr/bin/ruby
require 'rubygems'
require 'mechanize'

username = '07967123456'
password = 'mypassword'
number = ARGV.shift
message = ARGV * " "

if message.length > 120 || message.length < 1
$stderr.puts "Message too long or too short.."
exit 1
end

agent = WWW::Mechanize.new
agent.keep_alive = false
page = agent.get("https://services.orange.co.uk/sms/send")

form = agent.page.forms.last
form.userid = username
form.password = password
b = form.buttons.last
b.x = "12"
b.y = "20"
form.submit

puts agent.page.uri
#https://services.orange.co.uk/sam/templates/web/sign_in.htm
form = agent.page.forms.last
form.txtMSISDN = username
form.txtPassword = password
b = form.buttons.last
b.x = "33"
b.y = "44"
form.submit

puts agent.page.uri
#https://services.orange.co.uk/wps/portal/kcxml/04_Sj9SPykssy0xPLmnMz0vM0q_wyu_PZnmvSfDUbACQIYPZ
form = agent.page.forms.last
form.userid = username
form.password = password
b = form.buttons.last
b.x = "12"
b.y = "20"
form.submit

puts agent.page.uri

form = agent.page.forms.last
form.sendSmsMessageToNumber = number
form.sendSmsMessage = message
b = form.buttons.last
b.x = "12"
b.y = "20"
form.submit

puts agent.page.uri

form = agent.page.forms.last
form.request = "send"
b = form.buttons.last
b.x = "27"
b.y = "16"
form.submit

puts agent.page.uri
puts "message sent successfully"

Follow

Get every new post delivered to your Inbox.