So recently I’ve been playing around with Raspberry Pi type Internet of Things (IoT) devices… In my case I’m experimenting with OrangePi Zero and the C.H.I.P. Both of these are way small, way powerful processor headless computers. I’m trying to do fun and interesting things using these as control devices for special input/output. One of the things I’m interested in is ultra low latency… that is, an absolute minimal amount of time between user input and computer output.

I found an interesting article comparing the use of different programming languages to control things on a Raspberry Pi. Basically the guy hooks up an oscilloscope to and I/O pin, and then turns the pin on and off via different programs / shell commands. Its clear from that test, if you want to control things quickly, go to C for the win. So C it is.

I started playing around with code. I started playing around with different hardware.

First go was with the Orange Pi Zero, with Armbian Linux Server Image (Debian Jessie Legacy v 3.4.113 ) First test was to be using simple General Purpose Input/Output (GPIO) to blink some LED’s. It turns out the Orange Pi is a little bit off standard. To get the GPIO to work, we need to use a modified WiringPi library, courtesy of Github and user Zhaolei.

Orange Pi Zero ImageHere’s a photo of the Orange Pi Zero, an add-on shield with extra USB connections, an audio jack, a microphone and an infrared receiver. I also made a couple of LED jumpers for easy blinky I/O testing. In my case I wanted to use the on board microphone and audio jack… they work pretty well.

Let’s talk a little bit about software. With this device, I always planned on a headless installation. Generally my only contact would be thru SSH, either from desktop / laptop (Git Bash Command Line Interpreter) or mobile phone (with either the Termius or WebSSH app.) Coding consists of me writing original in Atom.io, then copying the code and pasting it into .c files via the nano editor. Compilation and shell run commands are run via the SSH tool.

I ALWAYS want a backup copy of the software I’m writing on my laptop/desktop. The only downside is there is no great way to delete a large block of code with nano. Frankly its easier to delete the file and copy/paste new again.

SSH Version:

  • Setup the remote device. Probably best to see that things are updated, via $ sudo apt-get update followed by $ sudo apt-get upgrade.
  • Verify Git is installed on the remote device. If not there, add it with $ sudo apt-get install git-core
  • Install the WiringOp (Orange Pi) library, via $ git clone https://github.com/zhaolei/WiringOP.git -b h3
  • Compile that library on the Orange Pi via $ cd WiringOP $ chmod +x ./build $ sudo ./build
  • Create a test file at the user directory (~/) via $ nano GPIO.c Copy, paste the code from Atom.io. Exit nano, save the file.
  • Compile the test file… $ gcc GPIO.c -o GPIO -lwiringPi The gcc -lwiringPi command links content from the wiringOP library.
  • Finally run the compiled file via $ ./GPIO . If you did this right, you should see some blinking LED’s. Yipee.

So far, so good. Now its about this time, I’m realizing that I will need to be writing some pretty involved programs. And one thing I don’t have is the ability to debug my code interactively in a convenient method. Its about this time in my research that I stumble over this posting, Visual C++ for Linux Development Wow. No, really… Wow. You can use Visual Studio to manage code, keep copy on your laptop/desktop computer, push code to remote device, AND run code in debugger mode. Way cool. The system uses GDB (the GNU DeBugger) to manage the process remotely.

Now at this point, I spent a heck of a long time trying to understand how Visual C++ for Linux development actually worked. I had more than a few problems, and I couldn’t tell if my troubles were based on my custom libraries or my Visual Studio setup. The answer here was to go back to basics, run the thing one step at a time and see that everything worked well. Now my first off-standard was my choice of the Orange Pi Zero. For a Visual Studio proveout, I reverted back to basics, and used a Raspberry Pi Model B. I set up a clean install.

  • Clear SD card via SDFormatter tool (Format type = Full, Format size adjustment = On). I used a 16Gb Samsung Evo MicroSD card in holder.
  • Download Raspbian Jessie Lite Minimal Image from raspberrypi.org
  • Unzip it. Push OS to SD card via Etcher.io
  • Update/Upgrade the OS. Add Git (same as above).
  • Add the WiringPi library to the remote device per these installation instructions.
  • $ git clone git://git.drogon.net/wiringPi $ cd ~/wiringPi $ ./build
  • You can verify the install via $ gpio readall which creates a handy pinout identification map.

gpio_readall

At this point its time to start up Microsoft Visual Studio. I’m using Visual Studio Community 2015, version 14.0.25431.01 with Update 3.

  • You are going to want to download and install the Visual C++ for Linux Development extension.
  • Install a few tools on the remote device $ sudo apt-get install openssh-server g++ gdb gdbserver
  • Add a few LED’s to your Raspberry Pi. I added one LED to wiringPi Pin #0 and another to wPi pin #1.
  • For me, this added one LED to actual pin 11, GND to pin 9 and one LED to pin 12, GND to pin 6. Verify that you have the LED’s oriented in the correct direction.
  • Create a new Project. Select Templates –> Visual C++ –> Cross Platform –> Linux
  • For this quick test, select ‘Blink (Raspberry)’. Accept the defaults, with one exception. Give the file name a .c suffix (and not a .cpp suffix)
  • You will have to set up the program as a ARM processor program, with a pull down selection in the top menu bar.
  • At some point you will have to add login credentials, via (Top Menu) Tools –> Options –> Cross Platform –> Connection Manager.
  • You can observe output via (Top Menu) Debug –> Linux Console.
  • When you click “Remote GDB Debugger” Visual Studio performs the compilation and execution processes.

Visual Studio creates the following files on the remote device (in this case, my Raspberry Pi). Project = Blink, code = main.c

    projects directory
        Blink directory
            bin directory
                ARM directory
                    Debug directory
                        Blink.out file
            obj directory
                ARM directory
                    Debug directory
                        main.o file
            main.c file

And that Blink.out file, it is fully executable via ssh and $ ./Blink.out . Note that the WiringPi library is located elsewhere on the remote linux device. If you inspect the sample code carefully, you will note two things.

  1. Right click on the Blink project in the Solution Explorer. Choose Properties –> Linker –> Input. In the block entitled “Library Dependencies” you will note ‘wiringPi’ This is the command line that tells the system to look for that library on the remote device. The files needed are actually located at /usr/local/lib (normally xxx.so files). Note: there is one thing here I wasn’t very happy about. What if you’ve neglected to compile the library files correctly? If you do that, you get an error message “fatal error: wiringPi.h: No such file or directory”. Wait, what? For a missing file on a remote device, that error message seems to be lacking, and probably should be improved. It’s not immediately obvious that the error is for code content on the remote device, instead, you are wondering what you did wrong on the desktop/laptop machine. My recommendation is “fatal error: wiringPi.h: No such file or directory at remote Linux device.” or words to that effect. The folks at Microsoft seem to agree, and as a result of my email to them, they’ve added this to their open issues list.
  2. The other thing of note on the Blink project is all the notes involving // LED Pin - wiringPi pin 0 is BCM_GPIO 17. So in the history of Arduino and Raspberry Pi’s there have been a whole lot of implementations of GPIO pin numbering. The whole WiringPi GPIO thing gives you the chance to custom define different pin schema’s. I will admit for most of us the whole thing is confusing. In this example, its very easy to get pin #0 to function. Starting from the code as written, its way difficult to get pin #1 to function. In this case BCM_GPIO pin #17 = WiringPi pin #0 = physical Pin #11, but what pin is used for WiringPi Pin #1? Hint, it you use the mating BCM_GPIO pin (#18) that is a total fail. Why? Because you have to declare each BCM_GPIO pin special via the Property Pages –> Build Events –> Remote Post-Build Event command. Yes it is important to understand that process, but not, Not, NOT for a beginner exercise. I wasted a good portion of time trying to understand the entire numbering scheme. For 99% of us, its just best to understand our hardware, ssh $ gpio readall to obtain a pin map for your hardware, and then simply use the WiringPi (wPi) pin numbering.

And heck, to make things easier, I’ll include my beginner approved code sample, RaspberryPiBlink.c (suggest you right click, and save document).

And by the way, just so we don’t forget why we’re using Visual Studio with the Raspberry Pi for programming… with the Gnu Debugger installed we can STEP DEBUG our program on the REMOTE device from within Visual Studio on the laptop/desktop easily. You can see a variable’s content. You can see the order of processing for complex calls. This is way cool, and well worth the tiny bit of extra effort it takes to get everything set up smoothly.

Raspberry Pi Blinky

The more I know about statistics, the more I despise sports.
red-marbles
I’m a big Dr. Deming fan. You remember Dr. W. Edwards Deming, right? He was a foremost statistician evangelist lecturing to manufacturing folks a few years ago. I was fortunate enough to see him in a lecture in Dearborn once. He did this cool thing with the audience. He asked ten volunteers to step up on the stage. He told them they were new employees in the Red Marble Company. The goal of the Red Marble Company was to… produce red marbles. Dr. Deming had this big bucket full of red and white marbles. He held the bucket up high, and each employee was asked to select ten marbles. The employees reached high into the bucket (sight unseen) and selected ten marbles. When all the employees got ten marbles, Dr. Deming did a tally on the number of red and white marbles selected by each employee. One lucky employee, Susan, produced 7 red marbles. Dr. Deming heaped lots of praise on Susan, gave her extra prizes and even a $$ bonus. Susan was so proud, she was beaming on stage. Then Dr. Deming went back to the tally results. One poor soul, Ernie, only produced 3 red marbles. Poor Ernie. No, really poor Ernie. Dr. Deming verbally abused the guy on stage, made him feel about one inch tall. “How could you do so poorly, look at what Susan has done?” This went on for sometime. You could actually see the guy cringe on stage. Everybody in the audience was quite uncomfortable with Ernie’s beat down.

But the message was CLEAR. The results of each employees marble selection were absolutely random. And it made zero sense to reward Susan and punish Ernie for what was clearly a series of random events. Woe is Management. Look at significant differences between employees, but account for randomization for exactly what it is.

World Series Cubs Indians Baseball

And lets fast forward to game seven of the 2016 World Series. I don’t normally watch sports on TV, but this game seemed special. I’ve lived in both Cleveland and Chicago for at least five years each. I know how important a win like the World Series can be to each of those cities. The game was fun to watch, well played by two very awesome teams. It went ten innings, each of them on the edge of your seat exciting. And at the conclusion of that game, the winner would be declared World Series Champions. As I watched the game, complete with DVR with rewind, and presenters with paint on the screen strike box, I noticed there were many “questionable” calls made, that I’m not sure I agree with. There were numerous pitches that looked like strikes, but called as balls, and vice versa. I know one scoring runner from the Cubs took his base on a 3-2 count that I believed to be a strike that was called as a ball. There may have been one base runner event (out? not out?) that didn’t hold well to instant replay, but wasn’t reversed… I will say the questionable calls went in both directions, one time supporting the Cubs, and another supporting the Indians. Shit happens. If any one of those events had gone the other way, we could have had a different final result. They’d be celebrating in Cleveland instead of in Chicago.

Am I complaining about the umpire staff? No way. Tough job, and I certainly wouldn’t want the job. But when I step back and look at the game as a whole, these events seemed random. Random enough that it reminded me of the Dr. Deming Red Marble Company. Two great baseball teams, both with high hopes and aspirations… but with only one declared the winner. In my view, that win, at least on that game, was largely a coin flip. And that’s why I gotta say… The more I know about statistics, the more I despise sports.

Baseball photo courtesy of AP Photo/Charlie Riedel

So I’m working on my desktop computer (with hard wired mouse) and every once in awhile the computer operating system (Windows 10) will start making notification noises and the mouse freezes up. Drives me batty. But I keep working on. Occasionally the cursor will freeze on the screen, so I place the computer into sleep mode (with a quick push on the power button) and then wake it up after a minute or two. That frees up the cursor.

But the problem doesn’t go away, it just gets worse. And I’ve already bought new mice over this in the past.

So today, I try something different. I take the mouse apart. I use a pair of tweezers and a vacuum cleaner to remove all dust dirt and HAIRS (2 each) from inside the mouse. Put it back together and presto! No more issues. I think one of the hairs got trapped in the top scroll wheel just enough to play havoc with the optical rotary encoder the operates from that wheel. Total easy fix. No more woes.

Hmmm.. So I’m checking my local Craigslist, looking for some wall mount speakers with the search terms “wall speakers”. Lo and behold, in my results I’m getting a whole bunch of ads from a Scuz Bucket selling artificial turf. Huh? So check the ad, and at first glance it’s pretty innocent.. a few lines of text advertising artificial turf. So wait a minute, how did that one pop on my search? So I do a Control-F search, and zing, there are displayed a huge amount of spam search terms hidden away in the ad. It seems the guy hid a bunch of stuff in a


way off to the right margin. There seem to be over a thousand words there.

Clearly a violation of Craiglist’s terms of service. The terms of service clearly prohibit “spam; miscategorized, overposted, cross-posted, or nonlocal content”. So yeah, the guy is an unscrupulous businessman. Would you buy anything from someone who thinks its okay to break the rules? Do you think these guys have an ounce of integrity? Someone you’d trust?

I was playing around with an idea for an application. I was interested in engaging customer input. I came up with this as interesting concept. It’s an online calculator to determine the volume of water in a swimming pool. The user types in an address, then creates a polygon that surrounds the pool. Add an average depth and its an easy determination to obtain the volume of the pool in gallons.

Pool Calculator

Try it yourself!

And if you are a pool supply company, this one’s for sale to you, cheap. Contact us from here…

A couple of notes:

  • It’s been a long while since I’ve looked at Google Mapping applications. I was pleasantly surprised to see the costs for these services VERY reasonable. Google has clearly adjusted pricing downward in the past few years. Kudos to them!
  • I set this up for US only. Obviously that can be enhanced.
  • The other surprise is the Google GeoLocator API key is available for server use only. You’d have to write a REST API server to perform the lookup correctly. I’m currently running a client API key, authorized for this domain only. This works temporarily but it’s really a hack.

.

BarbieGumby2

I’m working on repairing a laptop for a friend. She has very minimal needs, but reliability is one of them. I’m asking her to try Ubuntu Linux for a while. She’s totally open to the suggestion.

Here’s my question: How would you (simply) explain the difference between Windows Operating System and a Linux O/S to a total non technical person?

The only thing I could come up with was this:

Windows is like a Barbie Doll. She plays with Ken. They do cool stuff. You can dress her up, move her, do lots of different things. When you lose one of Barbies shoes, you really can’t buy just one more. If a dress rips, oh, well. There are a whole lot of accessories you can buy for Barbie. She’s way cute. She is fun to play with.

Linux is like a Gumby Doll. You can pose him, do different stuff. He plays with Pokey. They do cool stuff. He doesn’t come with many accessories, so there’s nothing to lose. Gumby costs a lot less than Barbie with all her accessories. He’s also VERY reliable. Not much to break, nothing to lose. He is fun to play with.

Anybody have a better way to explain the differences?

Barbie and Gumby image courtesy of Trash-n-Treasures Antiques & Collectables

So I happened to be looking at a SoundCloud website while chasing down a particular image. I opened the site in Chrome and then opened up the dev tools elements in Chrome. At the bottom of the screen, in the console, I was surprised to see

You like to look under the hood? Why not help us build the engine? http://soundcloud.com/jobs

The only folks who would even see this message is somebody looking at the details of the code. Way cool.

I often find myself looking at the details on large volume production sites as a learning experience…

  • What tools are they using and why?
  • Any special JavaScript libraries?
  • Is it organized well or obfuscated and ugly?
  • How many visible errors are there shown in the dev tools panel?
  • Are there any tools there that will help me become a better developer and service my customers better?

So I was talking to a former mechanic friend of mine. We were talking about tools. I was saying I don’t really understand why, but I just like owning nice tools and I really like that all the tools come from the same manufacturer. It’s like they’re an organized, integrated set. Yes I know that’s pretty anal… the sign of a perfectionist. (I always thought Snap On should give away a 15 piece tool set.. let folks get started and addicted. They’d make lots of money in the long run.)

Trucks in sandbox

But sometimes being really a perfectionist is a good thing, particularly where design and engineering come together. When you design something you really want it to be the best it can be. (insert your own rant here…)

The funny thing was, in talking to this friend, I was explaining that I was so anal that as a young kid, I couldn’t play with trucks and cars in the sandbox unless they were all the same scale. It just didn’t make sense that a Tonka Truck and a Hot Wheels car were on the same road together. Don’t know where that comes from, but I couldn’t have been more than six or seven. My friend, laughed and admitted he had the same scale issue when he was a kid.

Trucks in the sandbox image from Sandra Miller at ShutterBEANPhotography

So I’m trying to help a friend fix her Dell Inspiron N5050 laptop. The laptop has some odd operating system issues. It was a Windows 7 device, crashed hard. We’re trying to clean it up, get it back to Original condition (with the intent of a fresh install, then pushing Windows 7 –> Windows 10.)

dell-logo

Unfortunately there are no backup recovery DVD’s burned for this thing. Shit happens. So no problem. We’ll go over to Microsoft, and download the recovery disks there. At that page you have to enter the Windows original product key, to validate the .iso download. No problem, that seems more than fair. Ooops.

Error
The product key you entered appears to be for software pre-installed by the device manufacturer. Please contact the device manufacturer for software recovery options.

What the heck? The purchase of the laptop included the purchase of a Windows license, but we just can’t use it that way. So we move on!

I did find this article on recovery over at Dell and a link to the Dell Recovery Image. Wow. Can you imagine? The disk .iso files are available online. Way cool. Attaboy Dell! If this works, big kudos to Dell for doing this right, and making the software available… So we type in the Service Tag # to validate the download, and…

Recovery image not available for your Service Tag. Sorry, but a Dell Hosted Recovery Image is currently not available for the Service Tag that you entered. Please enter another Service Tag or contact Dell Technical Support for further assistance.

Well this is no fun. I’m on the phone with Dell. I can purchase the disks (ship only, not available via electronic data transfer.) They tell me that the download .iso file just isn’t available. Hmm.. they have the DVD’s but no .iso file(s). How do you spell customer service? Cost is around $25 or so and a delay of a week or so.

Mumble, mumble. I’m not happy. This makes me reconsider ALL of my Dell purchases. (I spent $1200 with them last year…) How can you take an idea, better customer service on the product and screw it up this badly? I can’t believe that the folks at Dell really want to be selling recovery DVD’s years after the sale. They’re not in the business of making profit from selling boot CD’s and DVD’s. They’re in the business of selling computers and awesome business and personal use products. That fact that they have a system in place to provide nearly trouble free support is awesome. The fact that they don’t bother to use their own system is a huge (negative) marketing thing gone wrong.

Here’s an image from Dell’s website:

customer engagement

customer engagement

This is terrible. How can you let customers down this way? What is the problem, converting DVD’s over to .iso files? Really? Hint: Consider an open source solution. Let us, the users do the work for you to make your electronic support systems better. Yes, it will cost a wee little bit for server storage, but I’m guessing you are saving those files somewhere within the Dell empire anyway.

Note: This whole thing is baffling. Why would Dell be selling DVD’s anyway? My worst suspicion is that Dell has sold the service contract (for much older computers) to an outside company, and those guys consider selling DVD’s at $25 a pop a major profit center for them. And part of that contract is Dell can not offer the product as an online download (Non-compete). If this is the case, shame on you Dell. You really suck. You need to treat customers with more respect and concern. Remember, the purchaser of the computer has already paid for a Windows Operating System license. Microsoft will give them access to the necessary software as a free download, but in this case Dell users are blocked, locked out of Microsoft, and forced to use the Dell service. Remember too, that every request for service is a failure (in hardware or software) somewhere along the line.

Dell, you have to treat customers better! When you treat us better we come back for our next purchase. When you push us away, we go elsewhere.

Note: Dell logo from Stefan Zaklin | Getty Images. Dell Customer engagement photo from dell.com

So I’ve been pretty excited about going to Hackathons. They are fun, you get to met new people, try different things, and have some fun. For those that don’t know, a Hackathon is sort of a contest between software folks to address a set of challenges to come up with something unique. Its an idea generation contest. It also provides a chance to learn what skills you don’t know, what you need to brush up on.

The biggest Hackathon of the year is the AT&T Hackathon that takes place in Las Vegas the weekend before the annual Consumer Electronics Show (CES). This year there were quite a few sponsors and a whole lot of prizes. After looking at the sponsor list, I came up with an early plan. I’ve been playing around with different tutorials on OpenCV (Open Source Computer Vision) and thought that would be a fun thing to play around with.

Looking at the challenges on the Hackathon list, I saw a challenge there for “It Can Wait”… an idea to reduce distracted driving. I also saw a challenge for best use of Intel Edison board. That got me to do a bit more research.

I discovered the Intel Garage videos, where they hook up a web camera to an Intel Edison, and are able to use OpenCV on that platform. I was able to reproduce these demos with an old USB webcam I had hanging around.

  • http://www.intel.com/content/www/us/en/do-it-yourself/garage-content/garage-facial-recognition-video.html
  • http://www.intel.com/content/www/us/en/do-it-yourself/garage-content/garage-webcam-hook-up-video.html
  • http://www.intel.com/content/www/us/en/do-it-yourself/garage-content/garage-streaming-web-video.html
  • http://www.intel.com/content/www/us/en/do-it-yourself/garage-content/garage-audio-voice-recognition-video.html

Awesome. At first glance it should be possible to add OpenCV to Intel Edison. Time for more research. I did discover a Github submission that uses OpenCV to track pupil gaze. Its not the entire thing, but its a very decent start towards making a proposal for a box that sits on the dashboard of a car, looks at the driver and detects when they are looking down at their mobile phone. Awesome idea. Form up a team before hand, make sure we have all the necessary cables and bits and we should be ready to develop something.

So we go to the Hackathon. One of our team members gets way sick. He’s clearly the smartest of all of us, but oh well, lets move on anyway. So we get to the hackathon, and we’re talking to a sponsor. He asks us what our plan is for the event. We tell him. He tells us, wait a second, wasn’t that the grand prize winner for 2015? He tells us, wait a minute, here is the Youtube video of the project. Oops. In fact, big oops. We quickly realize, there is no way we can repeat something that has been done before. Ouch.

So what next? We’re sitting around the table, moping about the issue. We’re visiting some of the sponsors, looking for good swag. One of the items we picked up for review was a Freedom ARM processor board from the folks at NXP / Freescale, a FRDMK64F . Its an Arduino style board with decent processor and memory, and the kit includes an accelerometer, magnetometer and gyroscope input card. Very cool. We start playing around with the board, as well as some items from other sponsors. We add a Ublox GPS sensor and an Konekt Dash (a digital cell phone / sim card transmit device) to the mix.

ShockWatchParts

And we think we have a feasible project. A guy I met in line decides to join us. Later two international students ask if they can join our team. Sounds great. We form a five person pick up team and by get started on the project around 5PM on Saturday. Its late but what do we have to lose. We break the project down to little steps, divide up the work and move it along. Most of the coding was done in C using the Mbed online IDE tool.

We’re making a Shock Watch device. Its a small battery operated box that detects GPS locations and monitors acceleration loads (shock G loads) Its placed in the back of an 18 wheeler truck to determine maximum loads placed on products being shipped. I’ve worked with plastics before, and heavy impact loads, particularly in cold weather, just don’t play well together. Think of an entire load of large screen TV’s being shipped across the midwest in January or February in sub-zero temperatures. Cold plastic doesn’t take impacts well at all. Our shock watch device monitors the G-forces, sends out a digital message to the cloud every five minutes. You can determine the location of rough road areas via GPS location. You can even monitor the location of the truck during transport. All data goes thru the Konekt server with the intent of storage at AT&T M2X data storage in the cloud.

Click here for presentation slides.

Its not our original idea, nor is it our original team. What makes this way cool is this project wins a $5000 kicker prize from a sponsor for unique use of their product, the Konekt Dash.

Lessons learned:

  • Its okay to abandon ideas to try something else out when you hit a road block.
  • Never give up.
  • Get organized.
  • Everybody has something to offer, no matter what their background. The two international students didn’t do a bit of coding. In hindsight, their input was instrumental in the teams getting to a prize. They kept us on track ensuring that critical team management events were done on time. They also created a wonderful Powerpoint slide show describing the project, and did so without prompting. That presentation really made our idea stand out.

TeamShockWatchAwesome

Thanks and Congrats to the “Shock Watch Awesome” team (L->R):
LB Corney, Las Vegas
Dirk Schmidhofer, Las Vegas
Daniel Kunkel, Seattle Area
Kanat Mustafin, International Student from Kazakhstan
Poy Yeung, International Student from China

« Previous PageNext Page »