Friday, 11 January 2013
Thursday, 27 September 2012
The Raspberry Pi is a fantastically versatile, cheap and tiny computer. It's very easily comparable to the ever popular Arduino, except that it provides significantly more processing power and programming options. One of the major drawbacks to this power, however, is the increased power consumption which makes powering the device problematic.
An import safety note about LiPo batteries!!!LiPo batteries are not for beginners, not for kids and not for adults who don't read safety precautions! Slightly over charging, over discharging or improper charging can cause serious explosions. Just looking at them funny can cause them to burst into flames!
A note on efficiency:BECs come in two varieties: switching and linear/unswitching. Linear ones rely on inefficient voltage regulators which waste a lot of the input power. Switching ones are a lot more efficient (mine is about 92%). It's worth the slight cost increase for a switching BEC.
Note that the terms UBEC (unswitching/linear) and SBEC (switching) are often confused. Particularly, Ultimate BEC is/was a brand of BEC, which was switching. Be sure to read the description when purchasing. (Thanks to the anonymous commenter for pointing this one out)
So that's what you need, now how do we put it all together?
1. Connectors for batteriesWhen buying a BEC, if you don't like soldering, make sure you buy one with the same connector as your battery. There are a few standard connectors, such as XT60 (my fav), JST, EC3, banana plug (should be avoided!!), and Traxxas. Make sure you buy a matching pair.
Obviously if you're a fan of soldering you're not limited here and can choose which ever BEC and battery you want.
Incidentally, you don't have to use LiPo batteries, you can use any battery which supplies a voltage which your BEC can handle (car batteries are 12v and around 40,000mAh!)
2. Connection to RPiThe only modification you need to make to your BEC is on the 5v side, at the connector to the RPi.
The pinout of a RC connector is one of the following:
We need to access the +5V and 0V pins on the RPi. The pinout of the RPi's pin header is:
The connector of the BEC is made of a plastic case with metal pins inside, which clip in place with a springy bit of plastic on the case.
Simply take a knife, pin or screwdriver and GENTLY raise the spring. You may need to wiggle the wire up and down a bit, but it will come out. Now just make sure it's lined up right and pop it into the correct slot.
That's it! Now, this bit scares me because one slip and you potentially fry your RPi. It may help to disconnect your battery from the BEC first, connect the BEC to the RPi then reconnect the battery (you should never leave your battery connected to your BEC anyway when it's not in use).
To connect, set your RPi with the Ethernet and USB ports towards you (the SD slot facing away from you). Locate the golden pins at the top right of the board. Slide your connector on, with the RED wire to the TOP, RIGHT-MOST pin, and the BLACK wire two pins towards you.
Provided that the RPi lights up, you can begin to enjoy mobile and more flexible projects!
DONT STOP READING YET!!Remember what I said about exploding batteries? Unless you want that to happen (hint: you don't) then pay attention!
When do you turn it off?Unlike your laptop, the RPi has absolutely no way to monitor the voltage or remaining capacity of the battery. This is a problem for two reasons:
1 - for LiPo users, over discharging your battery causes copper deposits to form and damages your batteries. If this goes too far it can actually cause an internal short, and when you charge it again the whole thing goes on fire (seriously)
2 - for everyone, if your RPi is busy doing stuff, it'll just shut down all of a sudden when it runs out of juice. That may or may not be a problem, but will probably lead to data corruption if you're writing data at the time (like when you pull the plug on your PC)
The only solution I have at the minute is to time the how long it has been running and pull the plug manually. I do mean literally pull the plug, because the RPi uses a significant amount of power when "off" as it does while running (106mA according to my meter, vs 300-400mA when running. This is OK for NiMH batteries but a disaster for LiPos. I'd love to hear any suggestions anyone has for how to get around this.
Sunday, 23 January 2011
Monday, 17 January 2011
After seeing Matt Richardson's video about his high-speed photography controller, I thought to myself "Wow, I want one of those!" And I had all the necessary bits, so I set about building one.
This post isn't going to be a how-to (I'll write one if enough people offer to buy me beer), but just general boasting about what it does.
What can it do?
Ok, so I now have a device which can trigger my camera's shutter, fire off a flashgun or turn a bunch of sockets on and off at my command. Just think of the possibilities!! It's basically up to me and what program I write.
Taking Matt's lead, I first created a program to take photos of popping balloons. Here's a rough outline of the process:
- Start the process (by pressing a button)
- Arduino turns room lights off (via a relay attached to an extension lead)
- Camera shutter opens
- Arduino waits for sound of balloon popping
- I stick a pointy thing in a balloon
- Arduino hears the sound, and fires off the external flash unit
- Camera shutter closes
- Room lights turn on
- Paddy has a beer to celebrate a successful day's work
I've also created a timelapse Arduino program, which allows me to repeatedly take photos a certain number of seconds apart - I created a simple video of a candle burning away, seen below
What I've used (essential stuff)
- 1x Arduino Pro (though most Arduinos are suitable)
- 1x Quad opto-isolator
- 1x 7d remote trigger (sabbotaged for its connector and cable) - A cheap knock-off one was ideal because it cost about £5 ($8)
- Various pieces of stripboard
- Various colours of wire - For wiring up the circuit, but I also used a lot to make the tails to go off to the external stuff like the flash and camera
- Real time clock module - allowing for more accurate timelapses
- Lots of male and female PCB pin headers - these make up the plugs for wires, or the slots to plug the Arduino in so it can be removed easily
- 4x LEDs (various colours) to show the status
- 2x PCB-mount buttons to set the functions
- Transistors - Arduino can't source enough current to power LEDs itself (though I'm told it can sink it - can any confirm?)
- Piezo transducer - to pick up loud sounds
- Photodiode - to pick up the light from a laser pointer (laser tripwire!)
- Various resistors - they're boring, but ya need 'em
- LCD status screen
- Ion cannon - not really essential for this project, but how cool would it be if you could take photos and then blow stuff up?
Some requirements I aimed for
- Control the camera focus and shutter (obviously) - the "how" is discussed below
- Control an external flash gun - also discussed below
- Two buttons to program the device - so I don't have to download a new program every time I want to change between "take picture when lights are bright" and "take picture when lights are dark" modes, for example
- 4 LEDs to display the status - in the end only 3 of mine worked, but it's still plenty
- Inputs and outputs should be as generic as possible
This wasn't always possible (i.e. for the camera connector) but where I could, I tried to make the inputs and outputs generic. For example, the relay to switch the sockets on and off is on a separate piece of stripboard, and just plugs into a simple digital out. This means I can design as many little plugins as I can think of and still use the same main board
- Input buttons have ports to plug external buttons in (so I can carry a button around with me, instead of having to be right beside the controller)
The camera (in this case a Canon EOS 7d) is controlled via the cable from a remote shutter release (about £5 on Amazon). These shutter releases (at least for Canon) are just simple switches. There are three wires in the cable - ground, focus and shutter. Connect focus to ground, the camera enters "focus" mode (like half-pressing your shutter button). Connect shutter to ground... well you get the idea.
In order to isolate my very expensive and love-of-my-life camera from my shoddy soldering, I used an opto-isolator. These little devices look like a standard IC chip, and basically consist of an LED on one side, and a photo-diode on the other. Apply a voltage to the input side, LED lights up, photo-diode allows a current through on the other side. You'll notice that there is no direct electrical connection between the input and output side - there's no need to worry about frying your camera if you short something out on the other side of the isolator, it provides about 7,500V of electrical isolation (or so the datasheet says).
I needed to be able to control an external flash to really get that "motion-stopping" effect. I have two external flashguns - a YN-460 and YN-468. The trigger for both of these is a hotshoe, which means the flashgun provides a 6V voltage on the center pin, and when this is brough to ground (via another contact around the edge of the shoe), the flash will fire. This sounds like another job for an opto-isolator!
To make things easier for me (and because I don't have any hotshoe adapters) I added a small homemade sync port, which you can read about here
External lighting control
This was such a good idea from Matt's video that I couldn't not do it!
Matt had a fancy extension lead with a digital input for turning it off and on. I don't have such crazy technology, so I had to make one myself.
What you see above is a small piece of stripboard, with relay which opens or closes based on a digital signal it receives from the Arduino. I've cut the live wire in a 4-way extension lead, and inserted the relay in the gap.
There's a little bit of circuitry so that the low current 5v output signal from the Arduino can power a 12v relay coil, but other than that it's very simple.
Because this board needs 12v, I usually power it directly, and I've added a socket so I can take power from this board and take it to my main board (which has the Arduino). The main board has an onboard regulator to give me 5v.
In this iteration there are 4 (3?) inputs - two buttons and a socket for a photodiode. I know I'd said I was trying to keep everything generic, but I didn't have the awesome idea of having additional bits of stripboard with extra circuitry at that stage.
One of the buttons also has a socket, so that I can plug an external button with a long wire on it. This gives me freedom to move around the scene, makeing life so much easier!
There's room for other inputs too, and another socket for an opto-isolator, but I haven't got round to doing the wiring yet.
This is coming in my next blog post. [INSERT LINK HERE]
For the results, see my Flickr Arduino tag
Find me at flickr.com/pskillen
Some more parts
Remote control button
Real time clock module
Friday, 7 January 2011
Now I've read more than a few posts about people adding PC sync ports to their flashes (especially the YN-46x series), but since I don't own a single PC sync cable or any kind of connectors, I decided to go with a more breadboard/Arduino friendly option.
This hack doesn't impare the function of the flashgun in any way - it still functions as a normal flashgun, via the hotshoe or optical slave. It's just got an extra connector.
What you see above is the finished product - the addition is just a tiny 2-pin PCB header, like the ones you get on the Arduino itself. It's cheap, tiny and versatile, and it fits right into the base of the unit.
And that's the inside of the base. I've simply drilled a few 3mm holes in the side, cleaned up the hole with a knife, and slid the connector in.
The connector (seen above right) is 2.56mm pitch female PCB header (the big black strip). It comes in rows of 20 and needs to be cut to size. You can do this with a knife (carefully, and on a cutting mat!). It's pretty cheap on eBay, which is good, because I go through stacks of it!
Once I had the hole drilled and the connector slid in place, I soldered from the terminals on the new connector to the terminals on the existing connector. Finally, I covered the whole thing in Uhu glue to keep it secure (I forgot that the centre pin moves up and down - DON'T PUT GLUE ON THE CENTER PIN)
What I have now is a flashgun which can be hooked up to a breadboard for use with an Arduino. To trigger the flash, simply join the two leads together (either physically, with a physical switch, or with some kind of electronic switch)
Check out my next blog post (still to be written) to see what you can achieve with a Canon 7d, flashgun, Arduino, laser, and things which will break or pop or explode
Monday, 3 January 2011
First post in a loooooong time! I've since picked up a new hobby, so you're going to be seeing a lot of posts about photography!
It's a well known fact that using a longer focal length lens, and then stepping backwards so you can still fit your subject in frame, will "compress" the perspective in your image (i.e. make background objects appear a lot closer to your foreground).
What I haven't been able to find out until today was the effect of using different focal lengths, but keeping the same shooting position and cropping the image down to the same field of view. Seems that this has no (or very little) effect on perspective.
Any slight differences in the image above are probably due to the effect of lens distortion (barrelling, pin cushioning), or me forgetting to focus on the same point for each frame.
Images above taken with a Canon EOS 7d (1.6x FOVCF), using a 28mm f/2.8, 50mm f/1.8 and the awesome 70-200mm f/4.0 USM. All shots taken at f/4.0
Monday, 19 April 2010
SourceForge link is: https://sourceforge.net/projects/ocpscada/
And the wiki link is: http://sourceforge.net/apps/mediawiki/ocpscada/
More details will follow, I'm sick of typing by now - I just spent the day filling my wiki