Energy consumption rant — again!

With Canada having recently CHICKENED OUT of the Kyoto treaty, I’ve had a look at my various little power supplies again. I’m talking about ‘wall warts’ / laptop power supplies and the likes. The ones I have are 100% switch-mode technology and most of them are pretty efficient and have a low standby consumption as well.

Except one.

The best ones I currently use for my various LED-lamp projects are all made by MeanWell and very affordable. Multirange input, 50/60Hz of course. I’d like to explicitly mention two of them:

MW3H36GS:

5, 6, 7.5, 9, 12V – 3A
13.5 (hard to find), 15V – 2.4A

Standby power consumption is well below 0.3W in all output voltage ranges.

MW3IP25FS:

3, 4.5, 5, 6, 7.5, 9, 12V – 2.25A

Standby power consumption is exceptionally low, in some cases my energy meter reads 0.0W!

The power supply that ticked me off (a pretty small and light one, which has its advantages as well), is made by T-ELEC:

SMP-1000A:

3, 4.5, 5, 6, 9, 12V – 1A

Standby power consumption in the lower voltages is tolerable, but not good. In 12V mode it consumes a full 2.3W to do absolutely nothing!

Using this inefficient one with one of my LED lamps read about 3.3W with everything off except a few status LEDs. The MeanWell ones read somewhere around <1W.

This doesn’t sound much, but once you let these things run 24/7 it adds up… which brings me back to Canada!

Even if you’re a ‘global warming’ skeptic and don’t believe what the models predict and could care less about CO2 reduction, it should at least strike you as odd as to why it is considered normal and acceptable (by some folk) to WASTE energy.

Does the assumed abundance of something (food, energy, oil, ore, water…) permit a blatantly wasteful lifestyle?

I think not!

I’ve started reading a blog about electronics and fixing things recently, good and helpful content. The author lives in the US of A. I will not mention his site. Several times he’s shown how he had fixed stuff that would ‘otherwise have ended up in the landfill’. It strikes ME as odd why he always seems to mention the ‘landfill’… as if they don’t do any form of recycling over there.

Well, the next wars will be about oil and gas – just like many of the previous ones to find ‘weapons of mass destruction’. Sure. I still feel somewhat sad for Collin Powell, I guess Bush and his cronies forced him to tell a lie to the world.

Posted in Dear Diary. | Tagged , , , , | 2 Comments

Riding a bicycle at night — Most bikers are braindead…

… or will be !

It was at night, it was raining, ice rain at times, the roads were covered with slippery leaves. I met a lot of bikers – some of them had their lights on. I was still angry with them a bit, as they only had the crappy kind of lights. But still they were visible against the background.

The other kind of bikers either did not have lights mounted to their bikes or simply didn’t turn them on. I almost crashed into one of them. I SCREAMED at all of them, called them names, the most vile swearwords I could think of. I told them to turn their f*cking lights on, multiple times in case of one or two of them. It didn’t do any good ;-(

YOU FUCKING RETARDS!

If you want to kill yourselves… fine with me! But at least have the decency to keep other bikers/pedestrians out of it.

I swear to <insert favourite deity here>, if I crash into one of you retards while riding my bike and survive it, I will make you remember that day!

Posted in Dear Diary. | Tagged , , , , , | Leave a comment

Arduino 1.0 — a few things you can do to save FLASH space

Since the release of Arduino 1.0, some libraries have seen a huge increase in compiled file size. This is _not_ a fix for those. This will be taken care of the community sooner or later!

Here are a few general things you can do to get a smaller .hex file size:

Make sure the used variables are of the correct size.

Use ‘char’ instead of ‘int’ if you only need it for a short for-loop counting from 0 to 10. It is also helpful for compiler optimizations to specify the variables as good as you can. Don’t need any negative numbers? Declare your variables as ‘unsigned …’, e.g. ‘unsigned char’, ‘unsigned int’, ‘uint8_t’, ‘uint16_t’…

Supply your own main() function!

Instead of the usual


void setup(void) {
}

void loop(void) {
}

use this to save a couple of 100 bytes of FLASH. This disables ‘serial event’ code btw.

int main(void) {
  init(); // don't forget this!
  {
   // place your setup code in here
  }
  while(1) {
   // place your loop code in here
  }
}

Using the hardware serial port

You can shave off a couple of hundred bytes by changing a few things in ‘HardwareSerial.cpp’. This applies the 1st tip to properly size and declare variables as needed.

Reduce ‘SERIAL_BUFFER_SIZE’ (both cases) to 8 or even 4.

Search for ‘struct ring_buffer’ and change ‘volatile int head’ to ‘volatile uint8_t head’, change ‘volatile int tail’ to ‘volatile uint8_t tail’.

Search for ‘inline void store_char(…)’ and replace the first part of the line starting with ‘int i = (unsigned int) …’ with ‘uint8_t i = (uint8_t) …’ and leave the remaining part as is.

On linux with avr-libc 1.7.1 or later

You can again save FLASH space (about 200 bytes), by using the built-in ’round()’ function of ‘math.h’ and disabling a #define in ‘Arduino.h’.

#if __AVR_LIBC_VERSION__ < 10701UL
   #define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#endif

Just add lines 1 and 3 around ‘#define round(x)…’ and you’re done. This is only effective if you actually use round(x) of course!

An Example

Compiling this example with an unmodified version of Arduino 1.0 and the ‘UNO’ board selected gives a file size of ’2596 bytes’!

/*
  DigitalReadSerial
 Reads a digital input on pin 2, prints the result to the serial monitor 

 This example code is in the public domain.
 */

void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT);
}

void loop() {
  int sensorValue = digitalRead(2);
  Serial.println(sensorValue);
}

File size with the modifications (buffer size of 4) to ‘HardwareSerial.cpp’ is ’2342 bytes’.

When using your own main() function as suggested above

/*
  DigitalReadSerial
 Reads a digital input on pin 2, prints the result to the serial monitor 

 This example code is in the public domain.
 */

int main(void) {
  init();

  Serial.begin(9600);
  pinMode(2, INPUT);

  while(1) {
    int sensorValue = digitalRead(2);
    Serial.println(sensorValue);
  }
}

the compiled file size is just ’2278 bytes’ !

Total savings for this test case: 318 bytes of FLASH space.

Happy hacking!

Posted in Arduino., Electronics. | Tagged , , , , | Leave a comment

What does it take to call something ‘open’ ?

I recently stumbled across this blog post. The writer talks fervently (a small play of words if you translate his avatar from German to English) about the open-ness of KiCAD, especially about the open-ness of the design files. In this case the author puts a very strong emphasis on cross-platform and cross-application portability – or lack thereof – of the ‘design’ itself.

What do You think of it?

To keep the discussion centralized, if one should start, please post comments to his blog.

Posted in Electronics., Software. | Tagged | Leave a comment

Zombie Meerkat — The compulsory Halloween project

2x red LEDs, 1x RGB LED, 1x ATtiny24, 1x MBI5168, 1x 470R potentiometer, 2x 270R, 1x 10k, 1x 294R resistors, perfboard, wire, solder and a lot of time.

The victim: a meerkat sculpture I wanted to ‘deal with’ last year already. The 5168 has one broken channel and the ATtiny24 has a broken brown-out reset module that goes berserk (hence turned off), so that’s a good excuse to use these two components in a permanent project.

Wuff wuff

BLUE meerkat zombie

RED meerkat zombie PINK meerkat zombie GREEN meerkat zombie BLUE meerkat zombie YELLOW meerkat zombie ?? meerkat zombie WHITE meerkat zombie Toilet paper is useful in many ways Meerkat intestines Meerkat intestines Meerkat zombie brain Brainless meerkat zombie Meerkat Zombie - timelapse

The whole contraption is powered by a 5V boost converter, which happily runs for quite a while with 2 half-dead AA batteries. A great way to completely use up otherwise unusable nearly empty batteries!

Meerkat zombie schematic

The final code revision used for it.

Posted in Electronics. | Tagged , , , , , , | Leave a comment