Programmable ATtiny IR remote

My Nikon DSLR camera does not have any internal programmable mode for continuous shooting (intervalometer) or socket in which wired remote shutter could be plugged in. The only way you can make exposures longer than 30 second is using IR remote. If you want to take only a few pictures, this is not a problem. But when you want to make a time lapse few hours long or photograph a meteor shower for whole night, this is no longer convenient. Especially when you want exposures to have the same length and the same interval between them, this can be very challenging.

That is why I took one of those cheap IR remotes and upgraded it using small ATtiny85 microcontroller. Its task is to simulate button presses depending on the settings of the DIP switch. The element in use consists of five switches. The first one (1) is used for selecting the operation mode. When switched ON continuous mode is selected and long exposure mode when it is turned OFF. Other four switches (5-2) determine the length of exposure or interval. You can change the settings during exposition, but they are not taken into account until the next exposition.

Front panel with ATtiny, DIP switch, MOS N-FET and power plug

Long exposure options – DIP switch 1 is set to OFF:

  • DIP switch 2 ⇒ 10 min
  • DIP switch 3 ⇒ 5 min
  • DIP switch 4 ⇒ 2 min
  • DIP switch 5 ⇒ 1 min

Total maximum time for a long exposure, when all switches are turned ON, is 18 minutes.

Continuous shooting (intervalometer) mode options – DIP switch 1 is set to ON:

  • DIP switch 2 ⇒ 120 s
  • DIP switch 3 ⇒ 60 s
  • DIP switch 4 ⇒ 30 s
  • DIP switch 5 ⇒ 10 s

Total maximum interval between two exposures in continuous shooting mode, when all switches are turned ON, is 240 seconds.

Back panel with voltage regulator and original IR remote

Button presses are simulated using MOS N-FET 2N7000 transistor (see the bottom image for wiring diagram). When pin 1 goes to HIGH the transistor opens and concludes an electric circuit that provides power to IR remote circuit.

Wiring diagram

The similar thing can be build without the whole IR remote circuit using only IR LED diode and microcontroller as output wave generator.

Simple Home automation using Arduino

I decided to upgrade the previous circuit with additional capabilities and intelligence. Using IR remote controller, relay and clock module it can be transformed into simple home automation system. Whereas the previous Arduino chip was lacking required ram space and I/O pins there was a need to add another one to the circuit board and to establish the serial link with the previous one that is managing the LCD display.

First thing needed was to figure out what HEX values the remote in use is producing to communicate with the device. I am using a remote that was bundled with USB TV-tuner, which is mainly used in another room. My remote has a total of 29 buttons however I am only interested in the fraction of them, here are the HEX values in use obtained for my remote.

  • A05F807F – Power
  • A05F906F – Num 1
  • A05F50AF – Num 2
  • A05FD02F – Num 3
  • A05FB24D – Display
  • A05FE817 – REC
  • A05F18E7 – Stop
  • A05FB847 – Fwd
  • A05F38C7 – Back
  • A05F6897 – Play/Pause
Test setup for testing IR receiver with remote.

The next thing to figure out was how to control the 8-relay module. Every relay in this module has 3 screw-type pins to control the high voltage AC current named NO(normally closed), NC(normally open) and COM(common connection). The 220/110V AC input must be connected to COM. The switch inside the relay is moved by the electromagnet that is indirectly connected to one of the Arduino ports. When the relay is turned off the COM is connected to NC and when turned on connected to NO. I am using the relay with revered logic which means that the relay is turned on when port is set to LOW. For every relay there is an on board LED that shows if it is active. The module has additional safety factor as all the relays are optically insulated, this means that all Arduino really does is turn on an LED inside an optocoupler, and that turns the relay on. So far I am using the relay module for switching the lights in my room, further applications are on the way.

8 – Relay switch module with two of them active. Top utp connector cable leading to Arduino, bottom high voltage cables leading to light bulbs.

Another novelties on the board are DS1307 RT Clock and piezo buzzer. Clock and buzzer together, combined with way to turn on/off the light bulbs in the room can be used for a brutal alarm clock.

Updated circuit board, clock module in the top-left, IR receiver in the bottom-left, UTP connector cable to relay module in top-right, piezo buzzer in bottom-right corner and additional Arduino UNO chip in the middle.
Wiring diagram – click on the image for full resolution.

Further things to add:

  • Sunrise alarm using light dimmer
  • Motion detection

Useful links:

Simple solar panel circuit

I got tired of replacing and recharging batteries every week therefore I bought a small (7cm by 7cm) solar panel that would charge batteries and power the weather station. Before mounting it on the roof of the shelter I measured its output voltage and current. The peak current was 70mA and the voltage of 6V, that is more than enough to cover the 10mA needs of the weather circuit.

Solar panel

The panel is connected to the batteries using Schottky diode on the positive lead that prevents battery discharge at night. This one-way valve allows current to flow from the panel to the battery, but does not allow current to flow backwards out of the battery through the solar panel. In this design I am continuously trickle charging the battery when sunlight is present.

Simple wiring diagram

Update: It works. So far a month on solar power.

Arduino weather station part 2

Sometimes I just do not have time to connect to the internet and check current weather conditions. This is the reason why I made this indoor LCD weather display based on Atmega328 Arduino MCU. The circuit board consists of two LP2950 voltage regulators, MCU, four buttons, ENC28J60 Ethernet module and LCD12864 graphic display module.The Ethernet module is used to connect to this website and to download current data. With it I am not limited to use only at home, but it can be used in any place with internet access. The input voltage is 3V3 so this is the reason why I have two voltage regulators. The connection to MCU is established using SCK, MISO, MIMO and SS digital pins.

Indoor weather station display disassembled.

The LCD12864 display uses ST7920 controller that has the option of parallel and serial communication. Serial communication is preferred because it uses only three digital pins (3, 8 and 9) instead of ten or more for parallel. Another advantage with this display is that it can be used in graphic mode. With it you can control individual pixels on screen. I used this to draw the sun or clouds depending on a outside conditions.

Display showing the current data.

LCD display in action. On the first screen you can see the current weather data (temperature, humidity, wind pressure, cloud coverage and sky temperature), the time when they were recorded and if the change from earlier time is positive, negative or constant. On the second picture the display is showing maximum and minimum within certain period and they can even be reset. All the captions are in Slovene language. More pictures can be found in gallery.
Display showing the limiting data.

The original library was meant to be used with Arduino Mega that has 4 times as much SRAM as ATmega328 I have been using. The screen buffer alone needs 1KB (128×64/8 = 1024 bytes) of memory that is half of the total memory one could use. Beside this in graphic mode you have to store every individual pixel of any character used, leading to overflown memory, leading to broken code and unexpected errors. If you do not want to change the look of the character while the program is running you can store them in FLASH memory along with the source code. Any variable the contents of which will be constant and not changed after initialization can be stored in FLASH using avr/pgmspace library. Doing so updated library can be successfully used on UNO an Duemilanove Arduino broads. Here you can download my updated version of the library I have been using for LCD 128×64.

Wiring diagram

Useful links at building this device:

Sorce of Arduino library for graphic display
Arduino ENC28J60 Ethernet library

Arduino weather station part 1

Finally the weather shelter is no longer empty. Inside it I put Arduino based weather station, made by me. I wanted it to drain as low power as possible so the Atmega328 MCU is sleeping most of the time except when it gets interrupt to send data to PC or when it detects that anemometer (wind speed) is moving. As voltage regulator I am using LP2950 instead of LM7805 or LD1117 as it has way lower quiescent current of aprox 100uA. That is 50 times less than 5mA as a LM7805 has. Station is running on four AA batteries so every mA counts and with this settup I get for around of two weeks energy. Connection to PC is done using serial Bluetooth module. All the data sent from the station can be seen here.

Inside the weather shelter.

Closer look.

Detectors used:

Anemometer – wind mill:


This one is made of scrap material found at home. The magnet is attached inside the cap and when it passes the hall switch US5881LUA detector Arduino gets interrupt to increase an integer that is measuring wind speed. The calibration was done with anemometer attached to the bicycle. I tested it while cycling at speed form 5 to 25 km/h and got a nice linear graph.

Hall switch with two stabilizing capacitors and pull-up resistor.

MLX90614 as cloud detector:

MLX90614 mounted on a top of the PVC pipe cap.

The MLX90614 is high-resolution I2C non-contact infra-red thermometer. For my purpose it is pointing to the sky and it is measuring the sky temperature. The temperature depends on whether the sky is clear or overcast. When the sky is clear the temperature is lower and when it is overcast the temperature is higher. Sadly this is not enough to detect clouds. In addition, it is necessary to measure the ambient temperature too. Cloud detector calculates the difference between the sky and ambient temperature. From the tests I deduced that difference of lees than 5 degree means 100% cloudy and difference higher than 22 degree is clear sky. My MLX90614 is not the best for this work as it has field of view of 90°, more suitable would be the one with FOV of 20° or 10°. The casing of the sensor is hermetically sealed and that way it can be directly mounted on top of the shelter without any need for additional rain protection.


This is digital high-precision barometric pressure and ambient temperature sensor. It is designed to be connected directly to a MCU via an I2C bus.


Analog humidity sensor.

Humidity (left) and pressure+temperature (right) sensor.

Pluviometer – rain gouge:

Tipping bucket

I even build rain gauge with tipping bucket, but it is not used in final setup as I have no use/need for precipitations data.

Wiring diagram, click on the picture for better resolution.

For even lover power consumption I replaced Bluetooth module with NRF24 wireless radio transmitter and added internal watchdog timer that wakes up microprocessor when it has to transmit data. NRF24 in comparison with BT drains current of tens uA in contrast of 5mA current for BT. The biggest difference can be seen when modules are not connected to PC. NRF uses the same amount of power in contrast to the BT that draws more than 50mA. Now the only serious power consumers are sensors that remain unchanged.

Useful links:
More pictures in gallery
Arduino library for MLX90614 IR Thermometer
BMP085 Sensor Tutorial
HIH-4030 can work with 3v3 input

Arduino telescope focuser

My goal was to use Arduino board to drive a stepper motor (from an old printer) that would be controlled via PC or hand held remote. Bipolar stepper motors can not be controlled directly with Arduino board so I had to use additional driver circuit (Allegro A4983). Ardunio feeds driver with three signals: step, enable and direction which determine the angular speed and direction of rotation. Remote has six buttons but so far only four are used for increasing/decreasing speed and movement control. Computer communicates with board over RS232 port with ASCOM drivers made by ejholmes. ASCOM standard is used in many astronomy software like MaximDL, Sharpcap,.. so you do not need additional software to control focuser.
Focuser works better than expected and is mainly used during imaging planets and DSO objects. Focusing by hand at that time is less accurate and almost impossible. The whole project costed me few € because I already had everything at home except a shaft coupler.Link to a source code for the focuser. Fell free to use, improve and comment, your feedback is desired.

Here is a picture of my telescope focuser with one of the focuser knobs removed and motor focuser attached instead of it. The motor’s and focuser’s shaft are joint directly by a shaft coupler.

Motor and circuit attached to focuser and telescope, ready for test under clear sky.
6-button remote, connected to Arduino by two 4-wire stretchable telephone RJ11 coiled cables.
Focuser wiring diagram

Helpful links at building this device:

More pictures in gallery
Ejholmes github site for ASCOM driver