Thursday, February 18, 2016

Arduino - Adventure #3

Is nothing ever easy? Adventure #3 involves rotating a servo motor back and forth 180°. Since all of my servo motors have a 3-hole female connector on the end, I didn't have bare wires available to connect it directly to my Arduino UNO. So instead of cutting the connector off the end of my motor, I decided to use one of the shields I've accumulated from different vendors. A shield is a board that can be plugged on top of the Arduino printed circuit board (PCB) extending its capability. Actually, I don't know that shields "extend" the capability as much as just make it easier to do something. In this case, I decided to use Pitsco's new shield, because it has 6 male connectors for servo motors, plus an additional connector for a battery pack, mounted right on top - no messing around with breadboards this time. All I had to do was plug in my motor and battery pack and I was ready to go. Right??...wrong!
Unfortunately, I discovered that the Pitsco shield was a bit bigger than my Arduino UNO - there were 4 extra pins sticking down with no holes available to fit them in. I had been told that this shield was totally compatible with the UNO, but it definitely wasn't.  Luckily, I had SparkFun's Arduino Redboard - an UNO look-alike, which fit the Pitsco shield perfectly. Upon doing some Google research, I discovered that I have an UNO original, which indeed is 4 pins shorter (2 each side) than the current Arduino UNO and SparkFun Redboard. The new UNO uses a different microchip which allows for faster transfer rates and more memory (always a nice improvement). The pin layout is identical between the two models, so I can still use my UNO when I'm breadboarding projects, but if I want to use a shield, I'll need to stick with the Redboard.

Wednesday, February 17, 2016

AppInventor

I've always wanted to write an app, so I decided to check out AppInventor. AppInventor is a cloud-based app-development tool that was originally provided by Google, but is now maintained by MIT. The good news is, it's free; the bad news is that it's limited to Android operating systems - not a problem for me with my Samsung phone, but limiting in that half the population own Apple products.
AppInventor uses drag-and-drop blocks of code, so it is fairly easy to put together a working app very quickly. There are a multitude of tutorials on the AppInventor website, and what's nice about them is that they are actually useful and fun. One of the tutorials is for a map tour of Paris showing attractions like the Eiffel Tower. The tutorial shows you how to incorporate Google maps and even couple the app to your phone's GPS. I personally prefer the programming in the campus map tour I found on YouTube. I made a map of downtown St Louis using my Paint program. This .png file became the background image for my canvas. The little green question marks are sprites indicating interesting sites along the route. Every time you click on a question mark, the canvas visibility is turned off and a picture, address, and short description appears for that site.

I personally think this is a great teaching tool, especially for early learners. Students can program silly little apps, like petting a kitty or painting a mustache on a photo. I've heard a few students complain that AppInventor is boring, but I think that is coming from classrooms where the teacher sits the student in front of a computer with the tutorials and does not encourage (allow?) the student to explore some of the creative (do-it-yourself) challenges. My next task with AppInventor is to write an app to control my NXT robot.

Monday, February 15, 2016

Arduino - Adventure #2

I've been spending a lot of time with AppInventor (more about that later), but I finally got back to the adventures (chapters) in my new Arduino book. Adventure #2 involves controlling a set of 3 LEDs with a potentiometer. This book is setup really well for students in that it takes you through the project in little steps. First, I connected 3 LEDs and lit them up in series (similar to chapter 1, but in triplicate). Then I hooked up the potentiometer by itself and played around with the different position settings. The final activity was to control the illumination of individual LEDs based on the position of the potentiometer. This book is great, because it not only teaches Arduino programming, but basic electronic circuitry. Chapter 2 also describes how to print status messages in the Serial Monitor on the computer screen - a really handy feature when you're trying to debug a program.
The final challenge in this adventure was to build a little electronic sign. This brings in the creative aspect for kids, and I would have constructed my own sign if I would have had a set of markers and some poster board handy. Next time.