Sunday, November 5, 2017

Pyranometer update

Data collection

I managed to do some work testing this weekend on the bare un attenuated sensor, its fairly overcast due to it being snowing being winter and all, the data goes from midnight to 6:00 pm. Seems to work fairly well so far although in the summer the intensity will probably saturate it completely. I will need to add a neutral density filter and amplify the signal.

Friday, November 3, 2017

homebrew pyranometer

Its been awhile since i've done any sensor projects so i figured i would take a crack at a pyranometer. The concept is relatively simple, essentially its a device that measures the radiative flux density of the sun.

The basic concepts simple, there are rather expensive scientific worldwide standards maintained that are designed to be very accurate and reproducible. Commercially produced models are calibrated against these under various classification standards. Not having access to one, the next best thing would be publicly available data recorded as geographically close as possible. Luckily the weather station at the airport in my city does take solar readings and provides live daily totals and monthly hourly totals.

The design:

There are 3 common types of pyranometers: photovoltaic, photodiode and thermopile. To start I went with a PIN type photodiode the BPW34 configured in a reverse bias mode. Since photodiodes performance is affected by temperature i threw in a TMP36 temperature sensor giving me -40 to 125c readings at +- 2 degrees of accuracy.

The short circuit amperage is roughly 1.86 milliamperes, with a bias voltage of 5 volts requires a resistor value of 2688.2 ohms. I used a 250 ohm 0.01% resistor along with a 5k screw turn potentiometer in series to provide an adjustable value.

This will provide a decent voltage response rate that will be easily measurable by an adc. The remainder of the electronics is an old arduino and a data logger shield i dusted off out from a drawer somewhere. 5 bolts reference with a 10 bit  adc is about 0.005 volts resolution. Using an rtc for timing i figure making an averaged sampling once a second should do nicely.

The code:

#include <Wire.h>
#include "RTClib.h"

#include <SPI.h>
#include <SD.h>
SdFile root;
File dataFile;
const int chipSelect = 10;

RTC_DS1307 rtc;

const int analogInPin = A0;
const int analogOutPin = 9;

unsigned int lightSum = 0;
unsigned int tempSum = 0;
byte count = 0;
float lightAverage = 0.0;
float tempAverage = 0.0;
DateTime now;
byte currentSecond = 0;
char filename[13];

void setup() {
  // initialize serial communications at 9600 bps:
  now =;
  dataFile =, FILE_WRITE);
  if (!dataFile) {
    Serial.println("cannot create file");
  else {
    Serial.println("create file");

void loop() {
  if (count > 63){
    lightAverage = (float) lightSum;
    lightAverage /= 64.0;

    tempAverage = (float) tempSum;
    tempAverage /= 64.0;
    tempAverage = ((tempAverage * (5000.0/1024.0)) - 500.0 ) / 10.0;
    now =;
    currentSecond = now.second();
    dataFile.print(now.year(), DEC);
    dataFile.print(now.month(), DEC);
    dataFile.print(, DEC);
    dataFile.print(now.hour(), DEC);
    dataFile.print(now.minute(), DEC);
    dataFile.print(now.second(), DEC);
    while (currentSecond == now.second()){
      now =;
    count = 0;
    lightSum = 0;
    tempSum = 0;
  else {
    lightSum += analogRead(A0);
    tempSum += analogRead(A1);


Nothing special to look at here, 10 bit sampling means a 0 to 1023 value, the atmega 32 has 16 bit unsigned integers so that is 64 samples cast into a float for the division to prevent rounding errors during accumulation. I could do some weighted averages or something to get around the limitations but this is fine. Samples are performed once every 10 milliseconds for both light and temperature readings. There probably should be a delay between the two readings but as a rough evaluation this is fine to start with. The output is simply written to a csv date stamped to the start of acquisition.

Saturday, October 18, 2014

Telecine Projector: Hardware Details

Quite a few years ago I did a digitization project for a number of 8mm reel to reel home movies. The setup was pretty simple: an old brownie projector, a large screen and a Hi-8 camera. The result was adequate for the time, but required quite a bit post processing to clean up. Film can run at 16 to 18 ish frames a second while the camera ran at 24 static. The color was off, everything was either too dim or over exposed. Additionally when a frame is advanced it is blocked off momentarily to prevent blur during pull-down, this is made more periodic to make it less noticeable to the human eye but causes serious issues with video cameras recording at a faster rate. At the time it took me 6 months to process mpeg-2 video, having to clean up frames one by one at times. This was around 2005 and my phone now is several times more powerful than my computer was then, the results were pretty good considering the resources at hand.

Sometime afterwards I acquired an old 8/Super 8 projector and decided to take another crack at this, having squired 50 or so more reels that needed digitizing. The first step was to gut the entire projector of its electrical, fabricate a new takeup reel and make modifications to the film gate.

Gutting the projector was the easy part, other than the lamp housing and the transformer there was little else in this thing.

Regarding the film gate, a sizeable portion of the film is not seen on the projection. The image is cropped down so the perforations are not visible along with the intermediate region between frames. Since i want to capture as much of the film as possible I enlarged the gate as much as possible for both Super-8 and Regular-8 Film

The original take up reel was missing so I ended up adapting one from an old reel to reel magnetic tape player, it fits and the wobbly thing on the end that allows the reel to hold tension in one direction while allowing the projector to go in reverse works.

I decided fairly early on to use an arduino for the brains of the projector. There isn't much requirements wise: control the brightness of the bulb, advance to the next frame, load film so i picked a fairly cheap easy to program Arduino and a motor control shield and called it a day.

The lamp was a bit of a tight fit, i needed sufficient material to act as a heat sink while allowing for enough room for a reflector without it touching the claw down mechanism. I used a 5300K CREE X-RE led module in a small drop in module cut down to size bolted onto a 1/4 inch thick piece of aluminium that i managed to cut down and make fit.

In order to drive the LED properly I threw together a simple NPN sink drive circuit with a 10 ohm 2 watt resistor in series. Generally driving a power LED with a resistor for current limiting is a bad idea but in this case the load is so small the chance of overheating and the resistor allowing too much current is not a concern.

In order to advance by a single frame I needed a way of knowing when the claw mechanism finished pulling down the next frame, fortunately them main drive pulley controls this directly via a notch on the side that pushes down a little spring arm. So using a black mark on the drive wheel and a photo reflective sensor this is easily achieved.

The original switch control has a position for threading the film that moves some channels to get the film to bend in the right shape. Back when I did this I was lazy and didn't probe out the original switch so I ended up mounting a mechanical switch where I could detect the mechanical position instead.

For the purpose of threading I installed a photo interrupt switch to detect the leader, since its more or less useless for detecting the film itself since it barely absorbs infrared light. 

Most of the hardware modifications ended up being straightforward however the camera took quite a bit time to get right. I ended up choosing a logitech c600 webcam for the imaging sensor, at the time it was the highest resolution 4:3 webcam available for end users. It took longer to find appropriate lenses that had a short enough focal point while being adjustable. I ended up going with a surplus machine vision 22mm lens that screwed into a brass bushing. The dimensions were perfect for it so slide into the mount that held the original projection lens. I glued the webcams lens mount to some scrap plastic that allowed the sensor to be centred in the bushing. The lens had a gear machined into it i ground off to make it fit flush to the projector.

I added a small heatsink to the lcd to try and keep it cool in an attempt to keep it cooler to reduce noise. No clue if it will help but doesn't hurt. The power supply is just an old atx psu i wired up for 12v and 3.3v power nothing special.

Tuesday, October 7, 2014

Hand Gattling Cannon Thingie

After some finagling with parts to make a good fit I managed to finish at least one of these, most of the work was building a cable harness connecting the switch, battery pack and the motor. The rest was finding acceptable materials for a friction drive for the motor.

It works reasonably well for a random prop idea cobbled together from scrap aluminium from a hard drive, curtain rods and a wine chiller.

Saturday, February 23, 2013

Light Table

Simply because i wanted to clear up some space currently being taken up by spare parts i built a light table. Basically its the front bezel and backlight from an old monitor, a ccfl driver and 12 power supply, a sheet of glass and a leg from an old portable barbecue.


Scrap Aluminum Challenge

While cleaning and sorting through my heap of things i noticed things bits and pieces that fit together. All of a sudden i found myself building a pair of Gatling style hand cannon props out of bits of scrap aluminum, hard drive platters and spindles.

I still have to cut the barrels to length and drill out the holes, had to order in a 16mm drill bit to match the diameter of the barrels. Also i will be trying to get the motors to run, i have my doubts the low torque motors would be able to turn with the added weight but i don't see a problem in trying.

Thursday, January 5, 2012

Projector Control Circuit Details

 I have received several requests for schematics and source code for the control system i built for my projector. After several months of delays and procrastinating here they are:
 The circuit is relatively straightforward, the relay is sunk by an npn transistor... there is a protection diode to prevent any unfortunate kickback. The reset pin on the micro controller is puled up with a 1k resistor and there is a 0.01 uF capacitor to filter power. The micro controller listens for a control signal and a feedback signal is given by pulling it to ground using an npn transistor.

The code is extremely simple, the mcu waits for the control signal to be high for more than 250ms then enables the feedback signal and turns on the relay until the control signal goes low. The entire thing is in an infinite loop.

#include <htc.h>
#define _XTAL_FREQ 4000000


void main()
    TRISIO = 0b111010;
    ANSEL = 0;
    CMCON = 7;
        GPIO = 0b000000;
        // wait for power on signal
        for(int x = 0; x < 250; x++)
            if(GPIO1 == 0) x = 0;
        GPIO = 0b000101;
        // wait for power off signal