My 2×1,5V battery iPhone Charger

IMG_1526

Figure 1

Making things is fun! Making an iPhone charger which uses two 1,5V AA batteries is actually easy! At the heart of this small project, there is a DC-DC step-up (boost) converter.

The main part is packed in an IC and only a few external components are necessary to build it, to be able to pump a little charge into your iPhone when there are no wall sockets around.

The whole stuff can be bought as a kit from Adafruit, including all the necessary components and a PCB. If you are in the US and want to save yourself some trouble getting all the components by yourself, -especially the IC and the PCB- then you might want to consider buying the kit from Adafruit.

Adafruit MintyBoost Kit – v3.0

However if you live outside the US, the additional international shipping costs might render this idea not worth to follow.

To save costs, I’ve decided to build it myself from the parts. All the components were relatively easy to come by from local electrical stores expect the IC and the PCB. However thanks to the generosity of the European Linear Technology sales office in Munich I could get two samples of the LT1302 IC for FREE!!! (Big thanks goes to Torsten Lessnau!) After this the only remaining item was the PCB. I went for the easy solution, by choosing a perfboard (stripboard, prototyping PCB). I only had to cut a few copper strips and add some jumper wires to make a replacement PCB for the project.

The datasheet for the LT1302 can be found here.

The circuit diagram to build this project can be found here.

The part list (version 3.0) is here.

The fully assembled and working project can be seen in figure 1.

Thanks Adafruit! Thanks Linear Technology!

Happy Charging! 🙂

My 2×1,5V battery iPhone Charger

Building my joule thief LED flashlight

Have you ever thought of hand-making your own little flashlight? Actually it’s easy! Well, you need only a few inexpensive and common components to build it.

What’s this?

To put it simple, a “Joule Thief” is an electrical circuit which makes it possible to light an LED with a lower voltage than it would normally need to function.

Use case

I’d like to make a small flashlight which requires only an AA battery (1.5 Volts) to operate.

How to make it?

You will need to wind a ferrite toroid with two wires. It is highly recommended to use two different color insulated wires because you will need to distinguish between them when soldering the parts together. The funny is that you will end up with four leads when done with the winding, but you will need three leads to make the connection to the other parts of the circuit. The trick is to choose two different color wires coming from the opposite side and solder them together. That’s it. Now you have only three leads.

Connect this “double” lead from the inductor to the switch, which is connected to the positive side of the battery in turn.

One of the “single” leads from the toroid should be connected to the base of the transistor through a 1 K resistor. The other goes to the collector.

You need to connect the emitter lead of the transistor to the negative side of the battery to close the circuit.

Components
  • White LED
  • TACT micro switch
  • 1 K resistor
  • 2N3904 transistor (NPN)
  • Ferrite toroid core (14.2X5X9)
  • Wires
  • 1 AA battery holder
  • 50x100mm Stripboard (prototyping PCB)
  • Rubber bands
  • AA battery

Of course you’ll need a soldering iron, solder and a helping hand with a magnifying glass attached too.

The finished flashlight

JouleThief_front JouleThief_side

great Joule Thief maker posts

Read more about the Joule Thief on Wikipedia

Building my joule thief LED flashlight

Programming an AVR MCU in JavaScript

arduinoyun

I have launched a project exploring some aspects of moving the development of an AVR MCU from the AVR/C++ world to the MIPS Linux/JavaScript world.

Code example:

// PWM glowing example.
// Copyright (C) 2015 Imre Horvath
//
// Build a circuit using a breadboard like this:
// Arduino Yun digital pin 11 (PWM) --> 270 R 5% --> 5 mm LED --> Arduino Yun GND
//
// This code below will cause the LED to glow first brighter and brighter gradually,
// then it will glow dimmer and dimmer till off.
// And then, this will repeat forever.

var firmata = require('firmata');
var board = new firmata.Board('/dev/ttyATH0', function (err) {

  var pwmPin = 11;
  var value = 0;
  var up = true;
  var incr = 10;

  if (err) {
    console.log(err);
    return;
  }

  function cleanExit() {
    board.reset();
    process.exit();
  }

  process.on('SIGTERM', cleanExit);
  process.on('SIGINT', cleanExit);

  board.pinMode(pwmPin, board.MODES.PWM);
  
  setInterval(function () {

    board.analogWrite(pwmPin, value);

    if (up) {
      if (value < 250) {
        value += incr;
      } else {
        up = false;
        value -= incr;
      }
    } else {
      if (value > 0) {
        value -= incr;
      } else {
        up = true;
        value += incr;
      }
    }
  }, 125);

});

Actually all the parts to assemble a system for experimenting are available.

  1. They have created the Arduino Yun, which is an ATMega AVR MCU connected to a Atheros MIPS Linux SOC with a serial line on board.
  2. There is the Arduino software to program the MCU
  3. There is the StandardFirmata sketch and the modification of it to enable it’s use within the Yun
  4. There is the Node.js and the serialport module with native extension provided through the Yun package repository
  5. You can configure BusyBox to start your node app at the end of the boot process, hence having a similar behaviour as with a native MCU, but with slower startup time
  6. You have SCP to transfer your app from your development machine to the Yun
  7. You can create a simple helper script to stop the old app on the Yun, transfer the new app and finally start it again.

It is an interesting idea to program an MCU in JavaScript, because of the language’s powerful features like closures, first-class function objects and higher-order functions. These features enable enormous expressive power compared to plain C/C++.

However transferring control from the AVR to the Embedded Linux on-board through a serial line (57600 baud) and the Firmata protocol on top of it, might render this idea useless for time critical real-time applications.

Also a lot of low-level (C/C++) libraries are available for the Arduino platform like the Arduino-IRremote which are unavailable and unusable on the Node.js side. While other low-level libraries like the one for controlling a WiFi shield are rendered unnecessary when using a Yun with the Linux side which already has WiFI capabilities.

Check out my GitHub repo on the topic!

Programming an AVR MCU in JavaScript