Sunday, April 27, 2014

SBEC - Time Lapse Photography

Time Lapse Photography Using an Embedded Computer

The Raspberry Pi with Camera Addon Attached
I have been doing a lot of work on the Raspberry Pi, or otherwise known as RPi for short, over the last several months. It's a wonderful device that opens up a lot of possibilities for embedded projects, but it has its draw backs. There is no power down after shut down, at least out of the box, and the GPIO ports are in limited supply. Then along came the BeagleBone Black, otherwise known as BBB, in my life, and with its extra features and power, and an incredible number of GPIO options. This presented me with some options to explore, and decisions to be made. 

The RPi has proven itself more than durable and reliable. I have had the same Rasbian distro running in it since a few days after I bought it. Back then, I quickly modified the OS to run off of an older 120 GB Western Digital Elements USB powered portable drive. I installed LAMP (Linux Apache MySQL and PHP) features, WEBMIN, and wrote a few daemons in C++. As far as logging sensor data to an onboard database, this device has been stellar!

The BeagleBone Black with the Logitech USB
HD Camera. Photo Courtesy of Derek Molloy
Shortly after, I bought the camera addon and did some work with it, but considering the limited mobility of the camera, I quickly shelved the research until I came up with a project where the RPi would be mobile and deploy-able with the camera. Now that the RPi is part of my Seed Bed Environmental Control project, I am revisiting using its camera for time lapse imagery and resurfacing is the issue of camera mobility.

Then I made a fantastic discovery! Actually two, when you consider Derek Molloy along with the BeagleBone Black. I have had the BBB for awhile but I really didn't do anything with it until I was able to add a powered USB hub, a wifi dongle, and an external hard drive. Also, the hard drive definitely needs to be replaced. I am currently using an older SATA 160gb drive, but it is a full size internal drive without a case, and needs to be powered. I am using a eSATA USB drive hub that has its own power supply, but it is way to big and too power greedy to be considered for 24/7 operation. At least I know that the BBB has proven to be as sturdy and reliable using an external drive for its OS as the RPi has been. I just need to find a small self-powered drive to take over. 

Derek Molloy
Engineer, Researcher and Educator
Dr. Derek Molloy is a Senior Lecturer in the School of Electronic Engineering, Faculty of Engineering & Computing at Dublin City University. He lectures in Object-oriented Programming, 3D Computer Graphics and Digital Electronics at postgraduate and undergraduate levels. His research interests are in the fields of Computer & Machine Vision, 3D Graphics & Visualisation, embedded systems and e-Learning.
Derek Molloy Site
Anyway, I happened upon Derek while I was researching using the USB connection to allow the BBB to access the internet through my laptop. Not only was his YouTube video (Beaglebone: Getting Started - Windows USB Network Adapter Setup) dead-on the subject and solved it for me, I learned a considerable amount of other things as well, and a 'fan' was born. Like many that possess the level of electrical engineering education as Derek does, like David Jones for example, there were many more videos to be viewed. And it did not stop there. I also found a wealth of information provided by this champion of EE, and it has really opened up my eyes to the BBB.

So I checked out his video offering where he covers using a USB HD webcam connected to a BBB to record HD video and capture HD imagery. What he describes goes miles beyond what I have found using the camera addon for the RPi. And since I want the best I can get when it comes to time-lapse of our seed beds, this is a really good reason to switch to the BBB from the RPi in my Seed Bed Environmental Control project.

I could add it to the project, but the project is so overkill as it is. I do not see a need to add a second embedded computer to the mix. I will have to install packages however that allow me to cross compile for it as I do with the Pi. I believe I will have to set up another cross compiling profile on my laptop's virtual machine because the BBB uses ARM v7 instructions versus RPi's ARM v6. I am not sure if this makes a difference. I will have to research this.
Comparing BeagleBone Black & Raspberry Pi...
"BBB has the ARM v7 instruction set so there is a wider range of distros available. Things are still in progress post April launch, but the orig Bone had Android, Debian, Fedora, Ubuntu, Angstrom & many more. The Pi's ARM v6 instruction set holds it back requiring specialized distros that recompile packages for the older instruction set (like Raspbian)."




Saturday, April 12, 2014

2.4 GHz Module Channel Selection - nRF24L01 – RF_CH Register

ChannelFrequency (Mhz)Description
0 to 822400 to 2482Legal, but noisy (conflicts with wireless LAN, Bluetooth, etc.)
83 to 992483 to 2499Not legal for mobile
1002500Licensed in BC to Inukshuk Wireless
101 to 1192501 to 2519Legal
120 to 1252520 to 2525National and regional systems (Department of Defence, Telus)

I have discovered that not all the channels this module is capable of using are legal, not to mention suitable. Noise, traffic (blue tooth, wifi, cordless phones, etc.), play a vital role when picking channels to use. According to this page nRF24L01 – RF_CH Register the suitable channel range is 101-119. This cuts options down quite a bit considering that each pair will need a channel. Still, 18 pairs/links is more than enough for what I am doing, for now anyway. If this pool size looks like it will be breached, I will have to get creative on channel assignments.

Monday, December 16, 2013

Serial Communications and Command Processing

Serial Communications and Command Processing

After learning about the wonderful handling of interrupts that the ARM Cortex processors sport, I went right after it, setting up interrupt handling of serial communications, effects processing, and command processing. Let us set aside the first two and dive into command processing.

After all, what fun would it be if we had all these LED effects and patterns set in the Teensy 3.1 and have no way to tweak them, or trigger them, other than to loop through them with a fixed timer of some sort? No fun at all I think. I mean, sure! They will look stunning as they fade from green to red, sparkle with fade effects. But unless they are linked to something, like music, or a movie clip, they are just effects running a set script that has no life at all. 

So, we established serial communications with the blue tooth, and my laptop, but unless I plan to sit by the door and manually trigger the effects with the laptop, I need a way to send commands to the effects processor (currently the Teensy 3.1) from another controller, that makes decisions based on numerous input conditions.

The Teensy 3.1 can handle all of that on its own I'm sure, but this isn't about efficiency. It's about performance, breaking out all the tech I have available. I can downscale later. Right now, let's add whatever we need to get the job done!

So we need a command processor. A way to interpret commands from another controller, act on those commands with parameters, and offer feedback through the same communications link. 

This offered a mix of issues, most of which attributed to my rusty experience with dealing with strings in C and C++. I broke all the rules here, but I got what I needed. The ability to send a command, have that realized and pushed onto a command stack, pulled at will and processed, rinse and repeat. The only annoying issue is that I have a carriage return character that seems to appear before every entered command. Using the replaced Teensy 3.0 to send automated commands to the project will hopefully fix this issue.

And that is where I am at right now. I have both Teensy's bread boarded and ready to test. Once I get past this hurdle, it will be time to work on the LED effects processor. And that will be the next post.

STAY TUNED!

More when I code it...

New Teensy 3.1!!

My new Teensy 3.1 arrived in the mail today. Yes, a standard envelope because it is so freaking SMALL! I immediately soldered on headers because I was afraid I would lose it!

The new Teensy sports a beefier processor that doubles the flash memory for programs and quadruples the ram! It is also faster. Running at 72 MHz now instead of 48 MHz, and still has the overclock at 96 MHz.

Thursday, December 12, 2013

Bluetooth Module - R&D, Testing, and the Code that Makes Use of It.

A lot of trial and error with this board, and it wasn't necessarily the board's fault. When you have more than one component that has to be tweaked to work in a system, it's hard to balance and find a working solution. Add to that a third party, and you have chaos that leads to an endless stream of expletives and uncontrollably thrown f-bombs!

I had a fourth party even. Maybe even a fifth if you count Putty and Window's quirkiness. Hey! Let's just add enough butterfly-effect devices and software to a new system and hope for the perfect storm of conditions to make it work! No wonder my new projects take infinity to become born!

Anyway, all rants aside, I achieved success after spending almost a whole day working on it. And now that I have you wondering what the hell I am talking about, let me clue you in.

Monday, December 2, 2013

Parts / Modules I Will Use and Exploit

Super Spectacular Christmas Door Wreath

Waiting for the Mail Man!

I thought I would write more about the hardware for this project while I wait for the guys in the vans to show up.

A lot of this stuff isn't necessary, but since I have it on my bench, I thought I would throw whatever I wanted at this project. I just hope the wreath mount that hangs over the top of the door can handle it!

The parts list looks like the ingredients of one of my recipes, or at least it is as busy as that.

Below is an outline of the hardware, and it's contribution to this masterpiece!


Sunday, December 1, 2013

Super Spectacular Christmas Door Wreath

Turn That Door Decor into a Eye Catching Holiday Show!

The common Christmas wreath for your front door adds a bit of holiday cheer to visiting family, neighbors, friends, or even yourself. You come up to your front door and see the wreath, and you are just filled with holiday spirit! It helps to wash away your work day and prepare you for the holiday spirit that awaits you inside.

But it is what it is. Albeit a nice arrangement, it just sits there. Not offering any mood changing experiences at all outside of what it stands for. You might be an interior decorator, specializing in holiday decor, so you might admire the placement of the pine cones, or the other Fall trim. But if not, you see just another wreath.

OR!

You could spice it up a bit, kick it up a notch mind you. Give it some interactive charm and pizzazz! Something that blows their shoes AND socks off before they walk in! Now you wouldn't even have to ask your guests to remove their shoes before walking in. They will be off and hanging in the front lawn's tree!

OK, maybe their footwear will not rocket off their feet at the site of this new creation, but they will be mesmerized to a point where they CAN wait for you to answer the door.

How?

We decorate it. With LIGHTS! Oh yeah! Not just some boring old string of incandescence, but bright and colorful LED lights! And not some stationary color or brightness, we animate it! After all, adding static lights is just more trim for an non-animated decoration.

But we will not stop there. We will also add a screen in that unexplored hole in the middle. Donuts have holes, reminding you that you paid for that hole that offers you nothing to enjoy. My favorite donuts have always been the fruit filled solid pucks of a donut. You get what you pay for!!

Anyway, this screen will of course show something. I can't think of anything better than the choice clippings of holiday fantastic works like It's a Wonderful Life! or, The Bishop's Wife. Perhaps A Christmas Story and Rudolph the Red Nosed Reindeer! And why not make the light show sync with the audio of these clips? SURE!

But what we have now is a stage show of a wreath. How the heck are we going to pull all this off?? EASY! We throw microcontrollers at it!

And that is what this blog will be about. My quest to enhance an already beautiful wreath with the most embedded holiday cheer my mind can offer!

Stay tuned! It will be an awesome ride!

More when I discover, build, and code it. =)

Thursday, August 15, 2013

Python! And the Raspberry Pi

Exploring the Python Programming Language to Control the RPi Camera

Appropriate that the RPi comes out of  John Cleese's Head
I have done wonderful things with the Raspi camera from the command line, and I'm totally satisfied that this RPi peripheral will satisfy all my needs for imaging. Now before me is the arduous task of controlling the camera via code in a web interface. Enter PYTHON!

Taken from Wikipedia...
An important goal of the Python developers is making Python fun to use. This is reflected in the origin of the name which comes from Monty Python,[34] and in an occasionally playful approach to tutorials and reference materials, for example using spam and eggs instead of the standard foo and bar.[35][36]
Being a huge fan of "Monty Python and The Holy Grail", "The Meaning of Life", and just about every episode of "Monty Python", I had to give this language a chance. I have written in DOS, assembly for an amazing list of processors, C, C+, C++, and C#, VS, VB, VBA, PHP, Java, HTML, and ASP. What's one more language? Except for confusing the common conventions, I'm excited about getting ANY Linux-friendly language under my belt. On thing I hate though, is not having a full debugging environment in an IDE, or even HAVING an IDE. Both of these issues don't exist anymore with Python, or so I have read.

So here I go, armed with a new language, a new platform, and new hardware. Discovery is where dreams are made, realized, and brought to reality!

More when I discover and code it. =)