On the other side of the hill

October 10th, 2010

Since last time I wrote here a lot of things have happened. For one, my licentiate thesis was successfully defended, and I must say that it feels good to have that enormous mountain of labour behind me. The seminar went fine and my opponent gave a constructive opposition – thanks!

So now when I have moved beyond the licentiate it is time to get my act together and collect some empirical data, which certainly is needed as my licentiate thesis lacked that vital part. During the last couple of weeks I have put much of my efforts in shaping up the tool I will be using during my coming efforts – Pinetree. The system was presented already at the ICALT2009 conference, but I have not had the time to incorporate the improvements to the system since then. Mostly thanks to the time consuming process of thesis writing. :S Anyhow, the system has reached a somewhat mature status, and with some bug fixes along the road I hope it will contribute to promote Linked Data.

The plan is to realise the ideas I have presented in my licentiate thesis, where digital content generated by learners can be enriched with RDF and interconnected via distributed Linked Data applications. For the interested reader I have added some documentation about the Pinetree system over here. My aim is to release the system as open source whenever I have enough time and energy to read up on how licenses works..I am a programmer, not a lawyer, so it might take some time. ^^ Alright, that’s it for today. Until next time.

Enhanced by Zemanta

Portable Modest Weather Station

June 3rd, 2010

Within the PhD level course Sensing, Semantics and Learning at LNU we have been working with the Arduino platform to explore the ability to formalise aspects of the real world context gathered from sensors. The main part of the course involved the sensing aspect of the title; semantics was explored to some extent through looking closer at Semantic Web technologies, while learning defined the application area in which the sensor kits have been developed. The progression from the initial workshop sessions to the final ones have resulted in two “productifications”, or sensor kits, and the idea behind this blog post is to introduce one of these along with photographs of the construction work.

This particular productification has been named Portable Modest Weather Station (PMWS). It is modest in the sense that it does not claim to be a full-fledged weather station as such; the purpose of it is to measure the relative humidity (in percentage) and temperature (in Celcius) and display the results on a small LCD screen. While the program running on the Arduino has been tailored for a particular purpose, the sensor kit has been designed with modularity in mind; sensors can easily be switched via an RJ11 socked attached on the sensor kit without opening the case. The PMWS sensor kit has been built on an Arduino Duemilanove along with the following sensors:

  • SHT15 ; Relative humidity and temperature sensor.
  • A potentiometer.

The SHT15 is used to collect readings from the physical environment while the potentiometer controls the contrast of the LCD display. Readings are updated once every second and presented on the LCD display. The LCD used in the PMWS is Hitachi HD44780 driver compatible, which was a requirement for the LiquidCrystal library to work. The LiquidCrystal library made the data output an easy task to realise through simple function calls, which can be seen in the PMWS code dump at the bottom of this blog post. The programming part of the SHT15 proved to be a bit more complex, but fortunately we located in this excellent blog post with a code snippet and a circuit diagram for this particular sensor. The entire kit runs on a regular 9V battery.

The first working version of the PMWS system can be seen in the figure below. In the photograph the potentiometer is located in the upper right section, while the SHT15 is located to the left of the Arduino board. As we can see, the display shows the temperature and humidity collected in real time from the SHT15.

The wiring in the above photograph had clear potential to be simplified, which is why the following step was to group and solder connections. This step was followed by discussions regarding the design of the sensor kit casing. A rectangular hole fitting the LCD display was made to the case along with holes for the potentiometer and RJ11 socket. The end result can be seen in the two photographs below. The leftmost photograph the knob for the potentiometer residing on the top of the case and the power switch on the right side of the case, while the rightmost photograph show the RJ11 socket connected to the SHT15 sensor located on the bottom of the case. In both of the photograph you can tell what the relative humidity and temperature was in the lab at the time of photography.

The construction of the PMWS show that anyone with at least some skills in programming and electronics can create their own sensor kits for a quite reasonable amount of money. The code presented in the appendix is mostly based on code snippets and examples available on the web, and wiring schemas and examples for various sensors are common on the Web. While we were several people involved in the making of the PMWS, I am confident that albeit my novice skills in electronics I eventually would have been able to construct this and similar setups on my own.

And here comes the code as promised:


// include the LiquidCrystal library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// SHT15 variables
int gTempCmd  = 0b00000011;
int gHumidCmd = 0b00000101;
int theDataPin  = 8;
int theClockPin = 9;

void setup() {
  // set up the LCD's number of rows and columns:
  lcd.begin(16, 2);
}

void loop() {
  int val;   // Temporary storage of readings
  int temp;  // Temperature value
  int humid; // Humidity value

  /***
  *  Temperature measurement
  */
  sendCommandSHT(gTempCmd, theDataPin, theClockPin);
  waitForResultSHT(theDataPin);
  val = getData16SHT(theDataPin, theClockPin);
  skipCrcSHT(theDataPin, theClockPin);
  lcd.setCursor(0, 0);
  // Farenheit
  temp = -40.0 + 0.018 * (float)val;
  // Conversion to celcius
  temp = (temp - 32) * 5/9;

  /***
  *  Humidity measurement
  */
  sendCommandSHT(gHumidCmd, theDataPin, theClockPin);
  waitForResultSHT(theDataPin);
  val = getData16SHT(theDataPin, theClockPin);
  skipCrcSHT(theDataPin, theClockPin);
  humid = -4.0 + 0.0405 * val + -0.0000028 * val * val;

  /***
  *  Output
  */
  if (humid > 0) {
    lcd.print("Temperature: ");
    lcd.print(temp);
    lcd.print("C");
    lcd.setCursor(0, 1);
    lcd.print("Humidity:    ");
    lcd.print(humid);
    lcd.print("%");
  } else {
    lcd.clear();
    lcd.print("Please connect");
    lcd.setCursor(0,1);
    lcd.print("sensor!");

  }
  delay(1000);
}

/***
* Code beyond this point is borrowed from
* http://www.glacialwanderer.com/hobbyrobotics/?p=5
*/
int shiftIn(int dataPin, int clockPin, int numBits)
{
   int ret = 0;
   int i;

   for (i=0; i

Enhanced by Zemanta

New design, new content

October 30th, 2009

A new day and a new design to the site, pretty neat huh? I decided to change to an already existing WordPress template as there are people out there who knows how to develop them properly. :P Besides the new design I have added information about a system we have been developing at CeLeKT called Pinetree, which is a content repository based on Linked Data. While it is not yet available for download we are discussing to either put it up as open source or provide a binary file somewhere on the Web. The system itself still lacks authorisation and authentication mechanisms as we are still thinking about how to realise these things in the best way and still reap the benefits of linked data. So the API and installation instructions are mainly for people here at CeLeKT who have access to the binaries.

A little more useful for people outside the CeLeKT group is the Pinetree core ontology. While it was designed for the Pinetree system, the ontology makes it possible to represent the logical structure of digital content residing in content repositories in general. It has intentionally been kept simple to promote its reuse in other contexts that Pinetree.

A bit annoyingly is that the W3C RDF validator service refuses to validate the ontology when using the “Check by URI” option, but if I paste the ontology into the “Direct Input” textfield it validates perfectly. My initial suspicion is directed towards the FTP server at my web hosting service but I’m out of clues at this point. If anyone have had the same experience I’d be happy to hear from you.

Reblog this post [with Zemanta]

Poking around with OAuth

June 8th, 2009

Summer has finally arrived which means that there is time over to work with fun stuff at work. During last week and this week I have been poking around with OAuth as authorisation method for Pinetree and other REST based apps under development here, and my initial reaction is that the existing libraries lacks documentation for implementing the 2-legged variant. It seems rather easy but getting the base string right when combining the JavaScript and Java libraries turned out to be less trivial than expected. Besides the wonderful guide at Hueniverse, the implementers’ draft accessible here was really helpful for those 2-legged setups.

*Update* I finally got the signature validation to work after removing all query parameters from the URL (or action) parameter of the message. Quite annoying and frankly I thought that it was taken care of automatically when calling OAuthHelper.getMessage(request), and the invalid_signature feedback was all but verbose when debugging this..

Reblog this post [with Zemanta]
  • Martin

  • Tweets

  • Categories

  • Archives