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. =)

Wednesday, August 14, 2013

Raspbian (Debian) LAMP with WEBMIN, SAMBA and FTP on the RPi

RPi Web Server not as Hungry on Resources as Expected

I now have my Raspberry Pi Model B Revision 2.0 running a fork of Debian called Raspbian, configured as a LAMP server. I added Samba and Webmin so I could access the web files, and use a web interface to monitor, control, and update the RPi from remote. Also added was FTP, although I am not certain this is necessary since Samba was installed.

webmin's front end status page served via my RPi
All works very well! I have served up my first web page and plan to have a lot of fun with that.

I initially thought about using Cherokee in place of Apache because of its reduced foot print and faster speeds. After researching it further though, I decided to stick with my old friend Apache. Cherokee is still fairly new by comparison so the community would be smaller. And I viewed a few comparisons showing its performance gains to be minimal.

Updating is really slow, but then we are using a single core 700 MHz processor. It is easy to see the difference between this hardware and perhaps a dated laptop, but then you think about how you are even making a comparison at all. Something this small running this type of software, and successfully!!

I killed the GUI via the raspi-config option for booting to the command line, and changed the memory allocated to the GPU to zero. Webmin (see image above) shows just a hair over 25% RAM usage.

Serving up files and web pages turned out to be necessary for my projects. I needed to be able to interact with my RPi without keyboard, video, and mouse, and a web interface is perfect for that. This will be the next stage of the project development. If all goes well, I will have this first device time lapse recording the perseid meteor shower Sunday night, Monday morning, and have the movie encoded and ready for download on my home network.

When I write something a little more functional for front page of the RPi's web interface, I will run a simple Apache AB on it and share the results on my next blog entry.

More when I code it. =)

Monday, August 12, 2013

Initial Impressions with the Raspberry Pi Model B Revision 2.0

I have run into a brick wall or two, but the hardware is awesome!

I have received my Raspberry Pi in the mail a few days ago, and finally had a chance to play with it Sunday. After a very scary initial attempt to get it working, I realized it was USER-ERROR and exercised best practices with the device, and all is good!

The device certainly has it's problems. The most important of those issues is power management. Set that issue aside though and you have an amazing device that gives embedded system designers a LARGE boost to their development projects. And my RPi is still running, responsive to my Putty commands from my laptop, and it has been 2 days so far!

As many before me have hoped for, this platform gives the user an opportunity to throw code at their invention. Running in a Linux Debian environment, I have been able to take total control of my camera addon hardware and run code on what I get from it. 

The most popular via YouTube now is what people are doing with this hardware and the camera, and taking breath-taking time-lapse images of their world. There are some interesting offerings on YouTube right now showing what this is looks like.

I for one am looking deeper. I want cameras on every corner of my house, on every vantage point of my Jeep. So my needs are a bit deeper.

For now, I want to monitor via time lapse, my seeding beds. But, in the future, I want to have a complete videography of my travels in my Jeep! This device makes that possible, but is it viable?

Only time will tell as I incorporate the hardware with my everyday life. CERTAINLY more to come.

Hop

Saturday, August 10, 2013

Time Lapse Imaging using the Raspberry Pi Model B Revision 2.0

HopWorks First Raspberry Pi Model B Project: Time Lapse Seed Starter Bed Imaging - IDEA STAGE

I just received my Raspberry Pi in the mail yesterday and I already have a quick use for it. I am going to mount it over my seed starter germination bed and use the camera to take time lapse images of the seeds as they germinate. This project will be expanded to allow time lapse images to be acquired from other sources, like IP cameras, web images, etc.

The idea here is to acquire and store high resolution images of our seed starter germination bed, store them, process them a bit, and make them available to the home network via FTP, web interface, or database access.

This should be easy enough to do for a functional starter project. But as some things in our lives seem simple at the end-result, often the inner-workings are a bit more complex. So let us get started!

First, I need to be sure the RPi (short for Raspberry Pi) is working. This involves placing the NOOBS software on a 8gb flash card, connecting a mouse, keyboard, and HDMI monitor, and booting up the RPi. Once in, I will have to set the IP address to a static one from a DHCP assigned one. Also, I will need to set up SSH access so I can terminal the device with my other machines and their installed Putty clients. When that is working, I will have to install LAMP (Linux, Apache, MYSQL, and PHP) software and configure it, set up VNC so I can remote access the RPi desktop, Finally, I will have to install support for the RPi camera device.

All that above is just to get going on the project. I will then have to write software, probably in Python, that will take an image from the camera at a set interval and store that image on the flash card. I will also have to write the web interface so those images may be obtained from other users on my network. I haven't decided how the images will be processed yet, but probably using PHP to time-stamp them, and use them to create on-demand movie files for time-lapse viewing. I already know how to include meta-data in the images and how to encode them to say JPG, PNG, or even raw format.

After all this is in place, I can code features that will allow me to acquire images from existing IP cameras on the network using the same image storing process. All of this on one networked RPi.

I have a lot of work to do on this so here I go! =)

More when I code it.

Hop