Jeenodes – fixing problems with code

I’ve got my first Jeenode up and running (after a rather disastrous soldering mistake which may have left the radio module toast) – and I am having a strange problem with some of the code.

This code is rather different from some of the Arduino code I have written and used so far, as one of the main aims is to use as little power as possible, to enable the Jeenode to run on a set of batteries.

And here is the problematic code :

static byte periodicSleep (word msecs) {

   // switch to idle mode while waiting for the next event


   // keep the easy tranmission mechanism going

   if (radioIsOn && rf12_easyPoll() == 0) {

   rf12_sleep(0); // turn the radio off

   radioIsOn = 0;


   // if we will wait for quite some time, go into total power down mode

// Serial.println(“ready for if radioison”);

   if (!radioIsOn) {

// Serial.println(“Radio is not on”);

   // see

   if (loseSomeTime(sleepTimer.remaining()))

   Serial.println(“ready for sleeptimer.set”);

   sleepTimer.set(1); // really did a power down, trigger right now


   // return true if the time has come to do something meaningful

   Serial.println(“ready for sleeptimer.poll”);

   return sleepTimer.poll(msecs);


where you can see the debug code I inserted to try to find the problem where the code never returned from the call to “periodicSleep”. Strangely enough the code suddenly starts to work when I enable the last debug line (return sleepTimer.poll(msecs);) – so more investigations to come.

Why Do So Many Terrorists Have Engineering Degrees

Oh dear – maybe we (engineers – I do have a degree in electronics) have to go on a watch list in the near future? (-;

Socguy noted that Slate is apparently a little desperate for some traffic as they are writing about”Why so many of the terrorists have engineering degrees, and they come to the conclusion that engineers and engineering students are much more likely to hold strong conservative and religious views than a general cross section of the public. Further, engineers tend to hold a particular mind-set that disdains ambiguity and compromise. Terrorist organizations have long recognized that engineering departments are fertile ground for recruitment and have concentrated their efforts there. A 2005 report from British intelligence noted that Islamic extremists were frequenting college campuses, looking for ‘inquisitive’ students who might be susceptible to their message. In particular, the report noted, they targeted engineers.”

Read more of this story at Slashdot.

[From Why Do So Many Terrorists Have Engineering Degrees]

Schneier on this week’s air-terror-scare, and TSA response

This speaks for itself

Bruce Schneier: a voice of reason, as usual.

Terrorism is rare, far rarer than many people think. It’s rare because very few people want to commit acts of terrorism, and executing a terrorist plot is much harder than television makes it appear.

The best defenses against terrorism are largely invisible: investigation, intelligence, and emergency response. But even these are less effective at keeping us safe than our social and political policies, both at home and abroad. However, our elected leaders don’t think this way: They are far more likely to implement security theater against movie-plot threats.

Is aviation security mostly for show? (CNN guest editorial)

[From Schneier on this week’s air-terror-scare, and TSA response]

Computer glitch turned off the lights in Norway

A story from a Norwegian newspaper – where one county forgot that year 2009 has 53 weeks and therefore omitted to program the automatic streetlight turning on every evening (short nights at the moment s well) – so the lights never turned on..

Lyset gikk da uke 53 ble glemt

Adressa-dokument onsdag 09.12. 2009
Gullkunder og svartskjermer
Noen av Norges mest profilerte selskaper er dratt inn i rettssaken mot Svein Kvarving. Elleve personer er dømt for å ha tatt imot bestikkelser fra Screen-sjefen. Etterforskningen har ført til at over 70 enkeltpersoner og firmaer er etterforsket. Les mer
Les mer
Legger vekt på grønne verdier
Du trenger ikke å vente til 2020 med å leve grønt. På Sverresborg i Trondheim er hverdagen til familien Kjønstad Prestvik grønn nesten tvers igjennom allerede i 2009. Les mer

Adressa-dokument fredag 04.12. 2009
Normalt å leve grønt om ti år
Den nye grønne norske hverdagen er bare ti år unna. Innen 2020 skal Norge kutte klimautslippene med 30 prosent. Les mer



Dere må tørre å møte oss!
Snart politikerhøring
Tillers metode
HIstorien om «Plompeper»

Lettere skadd i møteulykke i Spydeberg
Spydeberg (NTB): To menn i 50-årene pådro seg lettere skader i en frontkollisjon på fylkesvei 202 i Spydeberg i Østfold mandag formiddag. Les mer

Vil la Rudolf lyse med refleks
Les mer
Norge tar avstand fra Øst-Jerusalem-utbygging
Les mer


Tønsberg (NTB): Flere veier i Tønsberg ble totalt mørklagt natt til mandag fordi Skagerak Elektro hadde glemt at det er 53 uker i 2009.

[From Lyset gikk da uke 53 ble glemt –]

Yesterdays attempt to blow up a plane

As usual Bruce Schneier puts his finger on the problems with the current way of attempting to show us that security at airports is taken seriously :

Chechen terrorists did it in 2004. I said this in an interview with then TSA head Kip Hawley in 2007:

I don’t want to even think about how much C4 I can strap to my legs and walk through your magnetometers.

And what sort of magical thinking is behind the rumored TSA rule about keeping passengers seated during the last hour of flight? Do we really think the terrorist won’t think of blowing up their improvised explosive devices during the first hour of flight?

For years I’ve been saying this:

Only two things have made flying safer [since 9/11]: the reinforcement of cockpit doors, and the fact that passengers know now to resist hijackers.

This week, the second one worked over Detroit. Security succeeded.

EDITED TO ADD (12/26): Only one carry on? No electronics for the first hour of flight? I wish that, just once, some terrorist would try something that you can only foil by upgrading the passengers to first glass and giving them free drinks.

[From Separating Explosives from the Detonator]

HFS+ compression

I was not aware of the HFS+ file system compression feature until quite recently – this article is a good one :

now Leopard introduces a new feature that has been used on most of the system files: HFS+ compression. This compression is rather different than most other file compression options available in the sense that it is completely transparent; there isn’t even a way to tell that the files are compressed using Snow Leopard’s included command line tools (in fact, contrary to what some posts on this site have suggested, command line utilities like strings will see the same file regardless if it is compressed or not).

In order to even determine if a file is compressed using HFS+ compression or not, a tool like hfsdebug is needed.

[From 10.6: Compress files with HFS+ compression – Mac OS X Hints]

Beer fridge controller

I keep on finding even better usage examples for a Arduino :

Beer fridge controller 0.1
Hide entries like this

On the weekend I picked up a 220 liter beer fridge for $20. Its in really good condition (ignoring some minor rust in the freezer section), and the only real problem with it is that the thermostat doesn’t work leaving the compressor on the whole time. Doug suggested that instead of just buying a new thermostat, we should build an arduino fridge controller.

I’m not really a hardware guy, but once Doug had pointed me at the Dallas 1820 1-Wire temperature sensor, and lent me some resistors, it was pretty easy to pull the software side together. Note that this version doesn’t actually do any of the compressor control — it simulates that by turning a LED on. The compressor stuff has been delegated to Doug and will be mentioned later.

[From Beer fridge controller 0.1]

Not bad – I could see other uses for this as well…