Pentax IR Trigger

IMG_20170815_203021315_TOPSeveral years ago I was into astrophotography and I ended up building a barn door tracker, or Scotch mount, for use with my camera.  For this to work well I also needed a way to trigger my camera without touching it. My Pentax K-x uses an infrared signal as the shutter trigger for which an IR remote is normally used. For long exposures, my camera allows for an IR signal to open the shutter and another IR signal to close the shutter. My particular remote did not function very well and required me to manually press the buttons. This made consistent timing difficult and was boring. I wanted to automate this process so exposure times would be consistent and so that I could stargaze while my camera clicked away, or sit inside my warm house during a night of winter exposures.

PentaxIR SchematicI designed a small circuit to do this based on an Attiny25 microcontroller. The circuit is very simple consisting of a single AVR, two resistors, two LEDs (one red and one IR), and one tactile switch. Both LEDs are driven by a single pin on the AVR configured for output. The tactile switch is connected to a pin configured as input. The power input is 5v. Not shown in the schematic (but is present in the photograph) is a 5v L78L linear voltage regulator and a couple of ceramic caps. This allows me to power from sources up to 30v though I usually use a 12v UPS battery. Current draw is only 12mA so I don’t care to use a switching mode buck converter.

IMG_20170816_213151530The AVR is configured to run at 8Mhz and I also calibrated the internal oscillator with an oscilloscope to dial in on 8Mhz. A timer interrupt is configured to count each millisecond which the program uses as a clock. The C program is available here. The IR carrier frequency for the Pentax camera is 38kHz. The IR sequence for the shutter is 13ms of carrier frequency, 3ms pause, followed by seven 1ms pulses with 1ms pause between each. I have to admit, I found this sequence in someone else’s program, but it has been so long that the source escapes me.

To operate the IR trigger, the tactile switch is held down to set the exposure time. While the switch is held down the LEDs will flash once a second, each flash indicating one minute of exposure. To kick off the exposure sequence, the tactile switch is pressed for less than one second. After the exposure time has elapsed, the LEDs will flicker to signal the camera to close the shutter.  The exposure sequence will then repeat six seconds later. This six second pause allows the camera to process the previous image before beginning the next. If this delay is too short the camera may miss the shutter signal and become out of sync.

This has worked quite well for my needs allowing me to take many multi-minute exposures with almost no interaction from myself.

 

IMG_20170818_223411225
Setting exposure time. IR LED slightly visible.
14576188452_f4b7777e1d_o
The Milky Way, just below Vega (the bright star at the top). 10 stacked exposures, 4 minutes each. Total exposure time, 40 minutes.

Parts List

  • AVR Attiny25 x 1
  • 8 pin dip socket x 1
  • 220 ohm resistor x 2
  • Red LED x 1
  • IR LED x 1
  • Tactile switch x 1
  • Protoboard
    Optional:

  • L78L x 1
  • Ceramic caps (see L78L datasheet)

How NOT To Use Pushbuttons

Board Layout
ARM Pro Mini Board Layout
ARM Pro Mini Before Reflow
ARM Pro Mini Before Reflow

I decided to try my hand at making a simple ARM Cortex microcontroller board. I based my board on the ARM Pro Mini design. The ARM Pro Mini uses an NXP ARM Cortex M0 chip, and has the nice feature of letting you drag and drop program files on to the chip as a USB mass storage device.

I essentially copied the existing ARM Pro Mini schematic in KiCAD and then started making my own modified board layout. I ended up with a design that I could panelize to fit 8 copies on a SeeedStudio 10cm x 10cm board.

I ordered a set of boards from SeeedStudio, and got a laser cut solder paste stencil from OSH Stencils. I have reflowed a number of boards by just hand applying solder paste, but this design is the first I have attempted to use tiny 0402 sized resistors, and it has a tiny 32 pin QFN chip for the ARM processor. I pasted a board and got to work placing all of the components with tweezers. Time for the moment of truth! I put the populated board in the toaster oven and watched as the solder paste melted into nice shiny solder joints.

The board out of the oven looked really good.

Soldered Board
Soldered Board

I connected a USB cable and plugged the finished board into a computer. Initial signs were good. The power LED lit up, so at least the basic power input was good. Unfortunately, there was no sign of any actual USB device showing up in the operating system. I spent a bit of time troubleshooting the board. I first measured the DC power input voltages at all the pins they should be. I also checked for continuity between various pins to make sure that there were no short circuits between pins on any of the tiny surface mount chips. Everything seemed to be OK, so I spent some time reviewing my circuit design for errors. I double checked the schematic against the original ARM Pro Mini design and ruled out problems there.

Eureka!
While double checking some pinouts in data sheets, I found the problem… According to the datasheet of the pushbutton switches that I used on the board, the two terminals on each long side of the switch are tied together. I had unfortunately drawn the terminal layout in KiCAD rotated 90 degrees, tying the two terminals on each short edge of the switch together. This effectively makes my switches always “pushed” on my board.
PRO TIP:If you generally use any two opposite corners of most pushbutton switches, you can avoid this problem

Switch Pinout
Switch Pinout

How to Fix What You Screw Up
I sat around for a minute annoyed that I have a bunch of boards that won’t work. Then I started to brainstorm ideas for work arounds. I initially thought about some kind of intermediate adapter layer between the board and my switches. Then I came up with an alternate idea. What If I could rotate the switches and solder them on crooked?
I played around with rotating the switch footprint in KiCAD.

Looks like it should work!

Original Switch Layout
Original Switch Layout
Hacked switch layout
Hacked switch layout

 

 

 

 

 

 

 

 

 

 

I tried to unsolder the switches on my board, but melted them in the process. I got some fresh switches and did an ugly hand solder job to attempt to replace them in the new, slightly tilted orientation.

Switch hack
Switch hack

I gave the new fix a shot by plugging it in to my computer. Success! The board showed up as a new mass storage device and some quick test programs worked just fine.

New CNC Router Control Board

Our current CNC router is controlled by an Arduino Uno board with a perfboard shield on top that breaks out the connections to the motor drivers and limit switches. The perfboard solution was hacked together quickly to get the router up and running. One of our goals is to clean up the wiring and install it in a more permanent enclosure to help with maintenance, reliability, and electromagnetic interference issues.

To clean up the Arduino and perfboard piece, I made a new control board. The board is essentially an Arduino Uno clone, based on the Arduino Uno rev3 schematic.
cncboard_schematic
Board Design
I drew up a schematic in KiCAD that copies most of the Arduino Uno circuitry, but ommitted the DC power input subsystem, since we can power the board via USB from the router’s touchscreen computer. I used a surface mount ATMEGA 328 chip instead of the DIP packaged ATMEGA 328p that is on standard Uno boards. I connected the pins of the ATMEGA chip which are used by the Grbl control software to pin headers on the board.
cncboard_layout

I used KiCAD to lay out the PCB, ending up with a roughly 2.4in x 1.4in 2 layer board. I added some obligatory PaxSpace logos to the silkscreen and sent the board off to OSH Park to get a few boards manufactured.
oshboard

Board Assembly
I was contemplating applying solderpaste to the pads by hand using a toothpick or similar device. After I got the boards in the mail, I had a change of heart due to the teeny tiny size of the pads for the ATMEGA 16U2 USB bridge chip. I broke down and ordered a solderpaste stencil from OSH Stencils.

The stencil worked out great! I stenciled some paste onto the pads and placed all of the surface mount components carefully on the pads with tweezers. I stuck the poulated board into the reflow toaster oven at PaxSpace and watched the paste melt, soldering the components nicely in place. After reflowing the surface mount parts, I hand soldered the USB connector, the crystals, and the pin headers.

Solder paste and placing components
Solder paste and placing components

Board after baking in the toaster oven
Board after baking in the toaster oven

Oops
While I was placing the components on the board I realized that I had messed up the silkscreen labels on the bottom left of the board, swapping the ferrite bead and a capacitor. Luckily I caught the error somehow and put the components in the correct spots.

Somehow when I ordered the components for the board, I neglected to add 22 Ohm resistors to my order. These are needed for the USB lines on the chip. I ended up ordering some after reflowing the rest of the components and soldered them on by hand with a soldering iron.

Turning it on
Everything looked good after the initial assembly. I knew it wouldn’t work completely until I added those 22 Ohm resistors, but what the heck… I plugged it in and at least got the power LED to light up!

Oops again
I got the 22 Ohm resistors a week or so later and soldered those on. Then I tried to hook it up to a computer to start loading the firmware and Arduino bootloader on the chips. I started having weird intermittent problems with the USB connection. I noticed that the problems went away if I poked at the 22 Ohm resistors on the USB data lines. I went back and touched up my (terrible) hand soldering job on the new resistors and everything started working much better.

Next up, Grbl
I was able to get the Arduino bootloader set up on the 328 chip and can successfully upload Arduino sketches to the board. Next we can upload the Grbl CNC control software to the board and start testing it with some stepper motor drivers and limit switches.

Completed board
Completed board

Free Virtual Machines from Windows

microsoft-logo

 

At PaxSpace, we tend to use free and open-source software(OSS) for mostly everything we do. Most of our computers are setup with Linux. Most of our classes, workshops and workflows utilize OSS so that the everyday maker can use everything we use at the space at home.

You will notice that I’m adding a ‘most’ qualifier to the above statements because


it isn’t always possible to stick to a completely open-source tool-chain. Some utilities are Windows only products and they shouldn’t be discounted simply because they are not available on Linux. Most of these products can run reliably under Wine but alas, some do not.

One prime example that is close to PaxSpace is our 2015 Christmas Ornaments!

The ornaments use a PSoC microprocessor that is programmed using the PSoC Creator IDE. This is a great software product that is made freely available from Cypress but is only supported on Windows. People have tried to make it work under Wine but without much success. Luckily it turns out people have had success running it in a Windows Virtual Machine(VM)!

Typically Windows virtual machines aren’t easy to come by. A valid license key is still needed to keep one around and not be in disagreement with Microsoft’s End User License Agreement(EULA). This, fortunately, isn’t the case anymore. Microsoft is now providing virtual machine instances for developer testing. They provide Virtual Box instances, which are easy to use and manage, that will give you a 90-day trial period for the Operating System.

Now… 90-days doesn’t seem a very useful amount of time for an OS. What if I only need this software every 4 months? Interestingly enough VMs allow you to create what is called a snapshot. You can think of a snapshot as a picture of your system at a specific moment in time. You can startup a VM from any snapshot and have it think running back at day 1 of the 90 day trial period. Microsoft even recommends that you do this in their license terms documentation!

It is also highly recommended that you implement a rollback strategy for any virtual machines that you download. This could be as simple as holding onto the original archive that you downloaded, or you could take advantage of our virtualization platform’s snapshotting capability so that you can start over with a fresh VM at any time and not have to worry about the guest operating system running out of trial time.

This opens up many possibilities to run Windows only software in an open-source environment. You no longer need to own a copy of Windows nor have a dedicated machine somewhere for windows only development/workflows.

This entry was posted in and tagged . Bookmark the .

2015 PaxSpace Ornaments

The 2015 PaxSpace Christmas ornaments are here!

We have scheduled several group build sessions to work on assembling and programming your ornaments. See the sign up link below for information on dates and times.

Click here to sign up for a 2015 PaxSpace ornament kit.

2015_Ornament

We hope to see everyone at these build sessions and are looking forward to seeing what kind of cool things people can make their ornaments do.

‘Tis The Season To Hack Blinky Ornaments

We’ve been working on developing a PaxSpace Christmas ornament this year.  A bunch of Christmas ball-shaped PCBs have been designed and are on order from SeeedStudio.com.  The plan is that once the finished boards arrive, we will hold several workshops at PaxSpace to reflow solder the surface mount components, hand solder the through-hole LEDs and any other peripherals that you might want (such as a speaker, microphone, sensors, more LEDs, etc.), and to program the microcontroller on the board to blink the lights and control whatever you attached to it.

We’re planning to keep the cost of the workshop low, probably about $10 for PaxSpace members, and maybe a bit more for non-members.  This should be a good activity for people of any skill level.  You don’t need to be an electronics or software expert and can just do the parts of the build that you choose.  If you are an expert it will be a good challenge to hack the ornament do something cool.

 

 

 

The ornament will have a PSoC 4 microcontroller, 3 RGB LEDs, space for a bunch of extra LEDs, and some pin headers to attach other random peripherals.  There is space on the board to attach batteries, and a hole at the top to hang it from a Christmas tree.

Keep an eye out for updates on the ornament build workshops!

Evening Open House

evening_open_houseWe’re joining forces with the St. Mary’s County Library to hold an open house at PaxSpace this Friday evening, September 18th, from 6pm to 9pm.

This is a great opportunity to stop by PaxSpace if you haven’t yet been to our new location!  Come tour our facility, see some of our 3D printers in action, and learn about what PaxSpace and the St. Mary’s County Library have to offer makers, hobbyists, and business startups.

The event is free of charge and is open to the public.

Getting (Box Joint) Jiggy With It

I recently put together a box joint jig for the PaxSpace router table.  Box joints are used to join two pieces of wood using interlocking fingers- for things like drawer box corners, for example.  Box joints can look good, especially with contrasting wood types.  The joint is also strong, even stronger than more complicated dovetail joints when using modern glues.

The jig was made using scrap pieces of 3/4″ MDF for the main jig base, a piece of 3/4″ plywood for the front fence, and some scrap oak for the indexing guide pin and miter slot runner.  The basic design was copied from this YouTube video.

IMG_20150807_000855

One of the differentiating features of this jig is the microadjustment screw that is attached to the sliding fence face.  The screw allows the jig to be adjusted by a fraction of an inch in order to loosen or tighten the resulting fingers and gaps.  This turned out to be a good thing, because the initial setup of the jig made two pieces that were so tight that I couldn’t mate them together.  I made a small adjustment to the screw to make the finger gaps a hair wider, and everything works like a charm.

 

Here are the first test cuts with some scrap pieces of wood:

IMG_20150807_000905

Not too bad.  Now I just need to find a project to use some box joints on!

2015 Ham Radio Field Day

ham_field_day_2015
Every year the fourth weekend of June beckons ham radio operators from across North America to leave safety of their ham shack cocoon and head out to FIeld Day. It is a time for hams to practice their mastery over electromagnetic waves in more austere conditions so that they may be better prepared to serve their community in the event a natural disaster knocks out more modern, though less resilient, communications infrastructure.

It is also a time for camaraderie amongst fellow hams to show off their newest gear and for elmers (the term for seasoned hams) to share their knowledge with newer hams. As of late, it has also become an event to showcase what’s possible with amateur radio to a general public that has once again become interested in the DIY spirit that has been fostered by the Maker and STEAM Movements. In fact, April 2015 ended with highest number of active, licensed amateur radio operators ever in the United States with 730,283 hams.

This is the second year that PaxSpace has hosted a small “Get-On-The-Air” (GOTA) station for Field Day. A GOTA station let’s anyone, ham licensed or not, to experience the thrill of getting on the airwaves and talking with people all around the world. From our humble station at PaxSpace and operating under the callsign N1HNP, we were able to make QSOs (a term for radio contact) to hams in places such as Texas, California, Wisconsin, Vermont, Georgia, and even as far north as Ontario, Canada. The dozens of contacts made throughout the weekend were done using just enough power to light up an old 60-watt incandescent light bulb. We also had a chance to demonstrate a digital mode of communications known as PSK31 which allows you to essentially send text messages across the globe without the need for any intermediary equipment that modern computers and smartphones require.

Though you may have missed us this year, the good new is Field Day 2016 is only a year away! If you are interested in learning more about ham radio, we encourage you to check out American Radio Relay League (ARRL.org) and our local amateur radio club — St. Mary’s Amateur Radio Association (k3hki.org). Our local club offers many great courses to help you prepare to earn your Technician license which is the first of three grades of license in the United States, the subsequent classes being General and Extra. Hopefully by next year if we have a few additional PaxSpace hams we could set up a couple different radios to operate on a variety of frequencies and modes.