Wednesday, December 31, 2014

Post #13: Break from the Creeper and Christmas Break! XBOX Streaming discovery.

Took a Break

Sorry I’ve not posted in a while, however, since the last post I made pretty good progress on the “manual drive” portion of the creeper, I can get it going forwards and backwards just by tilting my android phone appropriately, reading the compass, choosing the correct heading, reading the Bluetooth, etc. 
4 months now!

In my last post, you saw we got a new puppy, she has been proving to be a big handful and the cause of most of my break on the creeper, but at 4 months she is settling a bit and after the new year I’ll pick things back up and continue coding it out.  The good news is, the PIXY performed nicely at school and the students are getting excited about working on it, so we’ll be picking up steam on the creeper again!  I've included a shot of the puppy here, purely for selfish reasons, I get more hits to my blog when I post pictures of Rue! :)

Networking (the internet kind)

In the meanwhile, I thought I would take some time during my Christmas vacation to play around with some networking software at home.  At work, I code/support a large installation of custom made software to measure traffic on several very large networks.  The code is built to be scaleable, to be automatically configured, inventory all the networks regularly, and send all of this data to support and billing systems.  I’m sometimes asked by folks “Why can’t you just use MRTG”.  (instead of a custom built solution that they don’t understand).

MRTG (Multi Router Traffic Grapher)

So, I thought I would gain a better understanding of MRTG by taking another look at it, on a smaller scale.  First, MRTG is a great tool, built on PERL.  I was able to install it on my MacPro at home pretty easily using HomeBrew, a software distribution mechanism for mac’s.  I tried compiling all the dependencies myself first, but that proved to be a pain as compiling code usually turns out to be, so installing it from HomeBrew made it a 20 minute thing, should have started with that first.  I was up and running in no time.  First though, I had to make sure my home wifi router supported SNMP, the network management protocol used to extract data from routers.  My RT-N56U router does indeed support it if you install external storage on it, download the necessary and turn it on.  I was able to research all of this on Google and turn on SNMP!
  
To make a long story longer, MRTG is a great tool for a contained network, one that you point MRTG at, it will go and begin collecting and even make nice HTML files for you to look at.  It is quick and easy.  Why it isn’t good for my purpose is for exactly the reasons outlined above, it doesn’t scale to where I need it to be.  Every live interface that it draws data for, it creates several files.  NOTE: I’m not using a database or RRDTool in my application, some of these files won’t exist down that path, but the data will live in a different kind of file nonetheless). 

Each interface gets 3 image files, a DAY, WEEK and MONTH PNG image file.  Also, each interface gets a LOG file to contain the data collected, and an HTML file to present the data.  This is pretty cool on a small scale.  If you use the database and RRDTool interface, the PNG’s won’t be created and the data in the LOG files will be stored in RRD database files instead.  But, the data is still stored in database files.  Also, if using RRDTool and an external database, the PNG drawings will be built when requested to be seen, this should be fast based on this architecture, but again, I have 1 million or more interfaces to worry about, I don’t want individual files/databases for them, I need things more accessible/scaleable/disaster recoverable than that.

I really like MRTG, but for scale, my solution at work is still the best choice for the business needs it serves, HOWEVER, for a quick look at what is going on without much hassle, assuming you have all the right access credentials you need, MRTG is a great tool to do just that (or even, for smaller scale networks).  It can certainly be extended to fit your needs, it is open source after all, but you may be in a cycle of continuous integration if you want to upgrade MRTG to the latest and greatest and most up to datest to get some new feature it has.

Anyway, playing around with MRTG and looking at the data it collects, I made some discoveries about my home entertainment characteristics I didn’t know.  Discoveries that are making me rethink my setup. 

My Home Entertainment Setup and the Network it Uses!

I have a Windows 8 server running Microsoft Media Center, connected to the cable company via a Ceton  InfiniTV 4 tuner PC card and a cable card interface.  This acts as my DVR, I can schedule recordings and pause live tv all through the Media Center Extender functionality on my XBOX 360’s.  I have 3 TV’s hooked up as media center extenders using 3 XBOX 360’s.  Obviously, the XBOX can do more than just be a media center extender, it plays cool games (Halo is my favorite) and can run Netflix, Hulu Plus, VUDU, TWC App, and more. 

Roku

This Christmas, my daughter wanted a ROKU, so we bought her one.  Also, I kept getting kicked out of Netflix due to an XBOX Live issue a couple of weeks back, it was so annoying that I decided to buy a ROKU 3 as well.  Needless to say, I Love it!  So much so that I then went out and bought a ROKU Stick for my little tv in the den so I can watch tv there too!  Since I have all this new tech AND the ability to measure how much network they use, I thought it would be cool (geeky kind of cool, I know) to see just how much network to validate my monitoring setup.  Keeping in mind that I use (or used to anyway) the XBOX for all of my entertainment needs, Netflix, Windows Media Center Extender, Hulu Plus, VUDU, etc.  Well…. Long story longer, here is what I found.

Roku vs XBOX 360

Running Netflix on my ROKU Stick (not even the ROKU 3), running at 1080p, streaming “I, Frankenstein” draws about 400KBps (3.2Mbps).  Running the SAME movie, during the SAME section of the movie on the XBOX360 with Netfix draws about 40KBps (0.32Mbps)!  Really?  XBOX Netflix streams 1/10 the bandwidth of ROKU!  The quality on the XBOX Netflix is capped at 720p, so that is one contributing factor.  Now I’ve never been totally happy with the quality of Netflix on my 61” TV, I always saw color banding, but it wasn’t horrible.  Compared to the ROKU though, the quality of the picture is drastic, and now I know why, Netflix must be pretty compressed coming in through the XBOX versus streaming it on the ROKU.  It is such a drastic difference that you cannot even see the usage on the chart at the scale it needs to be for the ROKU streaming!

Some definitions before looking at this chart.  I was able to identify the interfaces on my router and where they connect:
(LAN) - This is the wired network into my house served by the router (your wired computer hooks into this network)
(WAN) - This is the interface to the outside world, in my case, to Time Warner Cable roadrunner service
(5Ghz) - This is my second of Dual Band wifi, the 5Ghz band.  Your iPhones, iPads and laptops will probably connect to this wifi band
(2.4Ghz) - This is the standard wifi band, this happens to be what my Roku's are connecting to.
Showing network usage between WMC and ROKU, Netflix on ROKU and on XBOX360 (Click on pic to see full size)

Other services - Summary

To be fair, I also compared the TWC streaming app (Cable company streaming app) on ROKU versus the XBOX.  On my charts you’ll be able to see where I was streaming TWC via a ROKU3 (right after Netflix, the arrow pointing down to nothing in the WAN graph), and once again, you cannot see the traffic that TWC app was pulling from the internet while streaming on the XBOX, the traffic is so small.  Again, the quality difference isn’t totally noticeable unless you take the ROKU and put it on the same TV and compare side by side.  However, I like to have the best quality sound and video in my entertainment room, so now I know I’m not getting the best video out of my XBOX that I could have on the ROKU, so…. I’ll be purchasing another ROKU for my streaming needs!  The XBOX still excels at games and of course it is now the ONLY game in town to be a Windows Media Center Extender, functionality I also really like (people that come over really like it too).

Vudu at 1080p serving Ultra Violet
I also ran VUDU on my roku stick the other day at 1080p, and it came in at the expected 8Mbps while serving a movie I own up on UltraViolet, so all the numbers seem to be adding up, it is just that XBOX draws only a fraction of the network traffic that ROKU does.  I suppose if you have a network cap and you want to watch video that is “good enough”, XBOX is an awesome solution.  If you don’t have a network cap and want to watch the best video you can get your hands on while streaming, XBOX would not be your choice.  I’ve tried different setting and such on the XBOX and researched it a bit, turns out that I’ve tweaked the best picture out of XBOX that I can.

At least now I know (and now so do you).  Thanks for reading, hope this information is helpful to someone!



Monday, October 27, 2014

Post #12: Success (and Failure) and COOL

Meet Rue, my new time sink! :)
Sorry it took so long to create post #12, but recently had a new addition to the family, and sleep, well, sleep is overrated :).  Meet Rue, the competition for my robot building time and of course, my sleepy time :).

Also, I was waiting on more pins from Jameco so that I could make more wires, they came in on Saturday.

First the SUCCESS!

The new bluetooth module from Adafruit came in, remember when I said the first one wasn't working and I posted a link over to the support?  When I escalated to the support email, they responded quickly and offered to ship me a new one at whatever shipping speed I wanted, that was super cool, but I chose the cheapest shipping route anyway.  The new bluetooth module rocks, I was able to hook up my old Thunderbolt and my new LG G3!  I was even able to write some code down in the Arduino and read out the control characters sent.  It works great.  

With the exception of 2 or 3 wires left to hook the PIXY up to the Arduino, I'm for all practical purposes WIRING COMPLETE as well!  This is quite a milestone, this means that I can now focus on the code. I've been able to import the SHARP IR sensor libraries, I found a library for motor controls that I'm going to convert to regular code (it uses Delays, very bad for simultaneous control of anything), and even have all the pins defined and set up in the "SETUP" section of the code.  When I get it more complete, I'll post another page with the version 1.1 code (version 1.1 should have motor controls, bluetooth reads and IR sensor reads, along with the compass reads already done).

Now the FAIL :(

EVEN after checking the wiring on the SHARP modules 4 times (yeah, both of them), printing out the datasheets and triple checking my hookups, I put 5V on the Analog Output pin (yeah, on both of them!), thus huffing my IR Proximity Sensors (did I mention, BOTH OF THEM?)! OY VEY!  As I was writing code, I kept smelling something cooking, and it didn't come from the kitchen.  I smelled all around the bot, couldn't find it, then touched one of the sensors and it was burning hot!  ugh.  So ordered 2 more from Amazon, they will be here Wednesday.  Luckily, it will be an easy swap, but.... argh.  I guess this one we can blame on Rue and no sleep!  Oh well.  Can't make an omelet without breaking some eggs.

AND THE COOL

Another shot of the Arena, all set up!
The club is getting better and better at setting up the Arena. This pic shows it set up with all the blocks in place.  The thing is the size of a small bedroom!  It is very cool.  Now it is time to test the bots, make adjustments, troubleshoot failures (these can be a real shot in the dark).  The teams have done a great job to get to this point... but they are only in prototype stage, time to make improvements! I can actually help here as well, so now I don't feel so helpless!  I can least help assemble and tear down the arena LOL. 

MORE COOL!

Remember a couple posts ago I promised to post the video of the PIXY mounted and running on the creeper?  Enjoy.




Thursday, October 16, 2014

Post #11: Wrangling with Wiring

5 hours of wire wrangling
Sweet!  My parts (pins, wire, heat shrink tubing) came in!  So I removed all my old wiring I really didn't like, started making custom cables to the lengths that I really like WAY BETTER.

Took the whole top layer off, rewired the feeder wires (motor controls, power converter).

My special connector for the PIXY came in, took it back apart, assembled the special connector and re-assembled!  So far, I'm very pleased with the results!  (Even retested the PIXY, I'll post a new video when if finally uploads!)

Finally!  I can now hit the main power switch on the side of the creeper and have my Arduino power up and start running!  The program (from post 10) is still installed, so if the compass is hooked up correctly, the watchdog led on the Arduino should flash every time the compass is read. It does!  I'm so pleased.





30 year old Crimpers
Anyway, to create my custom cables, I used an old pin crimping tool I used 25 years ago when I installed process control equipment in paper mills.
using the Zippo to shrink the wrap
These pics show the crimper, the pins and the heat shrink tubing I protect the pin with. A standard Zippo is all I used to shrink the wrap.


Felt good to get those old crimpers back out... ah good times. Pretty sure they don't make them like that anymore.





TIME OUT

Lets take a quick look at the progress our bright young engineers are making on their competition bots.  Today we assembled the competition arena and the students even got to run their bots around and practice a bit.  One team is rebuilding, they really didn't like how their bot was operating with the angled omni wheels.... But the other two are ready, practicing and looking for improvements.  Enjoy!
The Freshman team's bot
The Senior teams bot

The arena, before the floor was placed.  It is pretty large, 12' by 12'

 TIME IN

Back to the creeper.  Adafruit is sending me a new Bluetooth (their Bluefruit module).  I tried everything I could think of, multiple times.... and just could not get the device to present a Serial profile for me to connect to. Adafruit support agreed and are sending me a new one free of charge. That is pretty good support. Feel free to read the thread HERE.  I went back and forth a tiny bit, but in the end, that first Bluefruit just wasn't cutting the mustard.  Hopefully, in the next post I'll have more software ready.

One of my upcoming challenges is figuring out the knobs I need to turn for motor controls.  I plan to use (at least right now) one PID controller object to control the turning of the bot.  For turning, the setpoint is going to be heading (compass vs pixy object location).  This will probably end up being complex, but it will all be explained in the end.

Thanks for reading.  We'll have some more fun stuff soon, I promise!  (wiring is not fun).











Sunday, October 12, 2014

Post #10: Some Progress, Some not so much

I've made a good step forward, and like with all engineering projects, a step back.  First the good.

The Good (wiring)

I think I have the wiring situation figured out.  I ordered some parts from Jameco: 6 different colors of 22AWG stranded hookup wire, some female pins to crimp on the end and while I was there, I found the specified power connector for the PIXY, a 2 pin female MOLEX connector so that I can power the PIXY separately instead of drawing current out of the Arduino.  I'm thinking this is going to be better as the PIXY seems to want to draw some current driving those servo's around.

The Good (first Arduino Sketch)

Output of Compass Module
I have written my first Arduino sketch (See it here).  I hooked up the compass module, started with the adafruit base and sensor libraries, and it went together pretty smoothly. Once the basic sketch was working, I began modifying it to remove all the bad things you don't want to have running in a real production Arduino script, like "delay" functions.  I replaced all the delay functions with a Timer function so that the loop can keep running, we just won't hit the compass every time through the loop. The picture on the right here shows the Arduino sketch running and reading from the compass the current heading information and converting that into Degrees!  That was an easy peasy thing to do, giving me hope the rest of the project is going to be this easy! :)

The Bad (Bluetooth not so easy)

The simplest hookup possible
Well, of course, I should have expected it.  No engineering project is ever easy, if it was, they wouldn't need engineers I suppose. I wired up the Bluetooth module and it seemed to work.  I was able to pair up my windows pc and my android phone, so far so good!  NOT SO FAST. The Serial protocol won't stand up properly. After several hours of messing around with it using both my Android phone and my Windows 8 laptop, nothing seems to be able to get the Serial protocol to start. So I opened a help ticket with the good folks at Adafruit.com (where I bought it).  If you click on that link you should be able to see the support request and the pictures I included to help them help me.

Hopefully Adafruit can tell me what I'm doing wrong and I can move forward! :). If not, when I get my wiring parts I'll hook up the IR proximity sensors.  I found some libraries that help stabilize the readings from them and make them more useful.  More on that in the next post!

Thanks for reading.


Tuesday, October 7, 2014

Post #9: Construction Complete!

The Creeper!
The long awaited (at least by me) completion day has finally arrived! At least the physical/component construction phase at any rate.

BEHOLD!  The Creeper!

Over the last 8 posts, I pretty much changed my mind several painful times, and no difference in this post.  But that can wait.  Did I mention....

BEHOLD!  The Creeper!

You can't imagine how relieved I am to finally reach this stage.  I started to wire things up a bit but am extremely unhappy with the prefab wiring I purchased, they are either too short or too long and the connections are too weak.  You can see all the wiring hanging out the sides, oh well, a challenge for another day.  Right now I'm thinking i'm going to Google around a bit to figure out how to make my own cables.

click to see larger version
click to see larger version
Anyway, as I hinted earlier, I changed my mind quite a few times down this road, and since my last post, yet again.  As I was locating parts and drill holes, I noticed that the compass module, located where I wanted it (top dead center, remember?) would place it very close to the servo's on the PIXY.  This had me a bit concerned, so I paused and googled about that compass module we have, and it turns out I was right.  It is sensitive to servos and motors and everyone recommends to locate it as far away as possible from both.  I still have the bluetooth located next to it, this may cause a problem down the road, but that is yet another bridge for another day.

the Pixy pan/tilt base plate
So, back to the drawing board.  I decided to remove the compass and set it aside for now.  I have a new anchor item, the PIXY has to go on first.  Lets figure out how to mount it and then worry about the compass.

PIXY pan/tilt base mounted
In order to mount the PIXY, you first have to disconnect the base plate and locate it. Mark your mouting holes, drill, tap.  Now, when you screw down the plate, it is made of plastic, so I was afraid I was going to break it if I made the screws too tight.  I luckily bought some nylon washers earlier at Home Depot, they were almost the perfect thickness.  I put a bit of loctite on the threads, screwed it down snug... the PIXY will remain secure.

for mounting PIXY to servo plate
The PIXY attaches to the servo plate that mounts on the base plate, this is done from the bottom, so I drilled a hole big enough to be able to get that tiny screw back in the servo plate that the PIXY mounts to.

Thats done. Now lets worry about out compass.
Bluetooth and compass at back of robot

I think the farthest point away from everything, the drive motors, the Arduino, power conditioning circuit, motor controller, etc.... would be on the very back of the bot.  Mounting it 180 degrees out of phase would take it even farther away from everything, no biggy, we will deal with phase correction in software.  This picture shows them mounted on the back, 180 degrees out of phase.


Next up, WIRING.  Lessons on making your own custom connectors coming to a blog near you....

Then.... testing out the component parts.  First the IR Distance sensors, then the compass, then the bluetooth, the compass -and- the bluetooth, THEN the PIXY (hardest for last).

Until then, I'll leave you with one more shot of THE CREEPER!

The Creeper.





Friday, October 3, 2014

Post #8: Fumble Recovery

Fumble Recovery
Tonight was a good night, I recovered my own fumble.  In the last post I mentioned how I created a circuit that was one giant short circuit, remember? After searching for a plan B, it occurred to me that if I had just a tiny bit of luck (actually, 50/50) and I have access to the traces on my little perfect board, I could cut them away and recover my mistake! Yay! As luck would have it, I can cut away the traces and get back to my perfect mounting scheme! (for all you experienced robot makers, this is probably old hat for you...).  I took a hack saw blade and ran it across the back in between each of the pins. Doesn't look nice, but you won't see it anyway.  It worked! An ohmmeter proves that no pin has continuity to any other pin it isn't supposed to! Plan A back on track.

Compass, top dead center.
Compass with Bluetooth
In fact, I finished soldering on the pins to my bluetooth and compass circuits, mounted this pcb to the top shelf and installed it all up just so I can 1) see if my compass is top dead center and 2) mark mounting locations for the rest of the boards. As you can see, the compass is top dead center (not sure if you can see the pencil lines that crisscross over the center of the panel). Next to the compass is the Bluetooth, there was enough room on that board for both. Mounting it off center gives me the space I needed to center the compass.

I've marked my holes for the Arduino and a power bus, now would be a good time to assemble the PIXY and see what it is going to look like so I can figure out how to mount it. The little black dots you see on the left of the mounted circuit mark the holes for the Arduino (I have to take my creation off the board before I drill new holes). That leaves the space over on the right (front) of the panel for the PIXY. The base on this thing is kind of big, I'm going to think about it for a bit, good ideas always come to me overnight.

the Assembled PIXY!
So, lets get to know our little PIXY. Here is a pic of the PIXY next to the platform. It is pretty large compared to the space I have to mount it. There are 4 holes on the bottom plate that look like I'll be able to use for mounting, but the challenge, how to re-attach the servo plate.... I'll think on this a while.

I followed all the instructions on the cmucam.org wiki page, sometimes twice.... can be confusing at times, I assembled a couple of things backwards, twice :).  Anyway, once it is all assembled and the wires all tucked away nicely, I went ahead and ran the pan/tilt demo. I'm glad I did, the pc kept complaining that it was using too much power, so... that means I'll really want to think about powering this little guy. Anyway, check out the pan/tilt demo, pretty much ran out of the box. I picked the yellow handles on my electricians tool to track, did pretty well!

Not bad for straight out of the box. There are tuning parameters for the proportional and derivative gains on the tilt and pan servos, but I didn't mess with them. The Arduino will be controlling the servos ultimately (telling the PIXY where to move the servos) so tuning the PID controllers in the Arduino will be the place where that gets done.

Anyway, good night.  Time for sleep :)

Tuesday, September 30, 2014

Post #7: SETBACK

Oy Vey.  This is not a success day, maybe just a learning moment :)

Top Deck layout challenge
I began setting up the top deck.  A lot has to go on here, but a couple of things on the top are anchors. The PIXY must go to the front, as far forward as i can get it and not interfere with the mounting bolts of the top deck.  The compass I would like to locate it top dead center of the top panel if at all possible.  I'm thinking this is the best position to get accurate/quick readings on the heading and not have to worry about the Y or Z axis.

Some things will be easy enough.  See the odd shape at the top of the picture?  That is the base plate for the PIXY pan/tilt module.  It is pretty big, takes up nearly the front half of the top deck.  That little board right below the PIXY is the compass. My challenge here is fitting that right in the middle of the top deck. Not sure how to mount it now that my plan A fell flat.

Plan A

I found this circuit boards at MicroCenter that I thought was perfect, put some sockets on the board, some pins that match so we can attach wires, plug in the circuit boards, mount the blank board on the top deck, and viola, done.  NOT SO FAST!

Here is what I laid out.  I _was_ going to use this super nice little board to mount my tough to mount circuits. I used 1/2 of the board for the compass and the other 1/2 for the Bluetooth module.  Perfect!

not.

one GIANT short circuit


Luckily, I decided to test out my little invention before committing pins to the bluetooth and compass boards. As with almost everything else in this hobby, this board does not come with documentation.
Good for Power Bus
Turns out that each row of pins is connected, you are supposed to use this as a power/ground bus (luckily for me, I was planning that later). Basically what I created was one big giant SHORT CIRCUIT!  So, if you find yourself at MicroCenter and see this item, unless you want a power bus, forget about it.

Now I have to figure out a plan B for mounting bluetooth and compass.  Those holes in the compass module are extremely small, a #4 screw wont fit, I need to find a #3 screw of some sort. Back to Lowes for ideas.  Lowes has some nylon screws, but they only go down to #8, way to big.  I can't find a #3-40 tap, anywhere locally.... so I'll have to drill holes and use nuts.  I might even use 2 sided tape if I can't find another solution.

I'll let you know what I figure out in the next post.  Sorry all.