The Great Half-Byte Blog Robot Challenge

Ok, people, you have that awesome Arduino or Arduino clone.  What are you doing with it? Doing something other than making an LED blink or getting temperature readings from a DHT-11? Well, here’s something:  The Great Half-Byte Blog Robot Challenge.  During the months  of September and October, we challenge you to build a robot using the common ATMega328. It doesn’t have to be a genuine Arduino, but should include the same bootloader and be software compatible—that means being able to load up the code in the Arduino IDE, along with any necessary libraries, and download to another without any changes.

The robot itself should have at least two wheels and enough intelligence to sense when it has hit an object and then go the opposite direction. You can use any commonly available components, including ultrasonic sensors, infrared, etc.

The challenge will run from September 7 through October 7. Submit your entries to this blog by leaving a comment below. Your entry should contain: text description of your robot, how you built it, parts, and any code (which you can zip up and upload to your favorite Drop Box, OneDrive, GoogleDrive,etc. Leave a link to the file in the comments. Photos should be put a photo sharing site, like Flikr, and linked back here.

We will judge the entries by originality, appearance, simplicity and code.  The top five entries will be featured on the blog. 

Please do not start until September 7, 2014. 

Have fun!

Advertisements

Burning the bootloader on a ATMega 328p with two Arduino UNO’s

IMG_4386 (3)In my zeal to keep my costs down on the Half-Byte Console project, I mistakenly ordered a bunch of ATMega328p controller chips without any bootloader. Oh well, I thought, they are easy to program. So, armed with Bing and the Goog, I set out find a simple, quick solution that would not require a tremendous amount of work. After all, I did order quite a few of them.

There are a lot of how-to’s out there, some of them really well done.  But, they did require either things I do not have, like a breadboard (I know, I know!) or just took too long.  Eventually, however, I stumbled across this post that pointed the way.

A sketch, called OptiLoader, is the key. Written by Bill Westfield, the loader can work with or without a computer. It requires two Arduino boards (I am using two UNO boards) with one UNO containing a programmed 328 with the OptiLoader sketch uploaded and a second, slave UNO with the unprogrammed (or programmed, if you want to change the bootloader) 328. You need to connect WP_20140708_001the two UNO’s like this:

  1. Pin 10 on master UNO to RESET on the slave UNO
  2. Pin 11 to Pin 11
  3. Pin 12 to Pin 12
  4. Pin 13 to Pin 13

Once the ‘master’ UNO has the sketch uploaded, and you have inserted the unprogrammed 328 into the slave, connect +5 and GND on the master to the slave to give it power (I am assuming the master already has power, if not, give it some.)

Once both are powered up, the master will check the slave to see what it is and then burn the correct bootloader. Once complete, the slave is shut down. Remove power and then remove the chip. At this point, you can program another by placing the new chip in the slave, apply power and then press reset on the master. 

You can watch the progress on your computer if the master is connected. If it is, open a terminal window from the Arduino IDE, select 19200 for the baud rate and press reset on the master. The OpitLoader gives you all kinds of info and even tells you when it is ready to repeat the process.

OptiLoader is very well done and contains the images for the bootloaders. 

This method takes less than a minute to do and works well. 

 

Links:
OptiLoader from GitHub
Forum Post

Real do it yourself computer using Arduino or…how to make your own game console

IMG_3043Ever since I was a kid, there were two things I’ve always wanted to build: a computer and my own video game ‘console.’ Now, I grew up in the seventies and eighties, so both of these things were pretty crude, some even crude when they were new (RCA Cosmac, I’m looking at you!) While in the intervening years, I did ‘build’ both, I cheated in doing so. With the computer, ‘building’ one was simply buying premade cards and a motherboard and installing them, hardly building one. With the video game ‘console’, I assembled a ‘pong’ style game from a kit (which I wrote about here.)

Now that I have discovered the wonderful world of microcontrollers, I can, finally, actually build both of them.mk121pal

Today’s microcontrollers are as powerful, if not more so, than yesterday’s microcomputers. For instance, the ATMega 328 is every bit as capable as the 8080, one of the mainstays in the 1970’s. Because of this, you can build real computers that are very small and require little power. They also require substantially fewer parts to work and be useful.

While I am no electronics engineer, these chips are simple enough for even someone like myself to design and build a working computer that can, subsequently, become a game console.  Companies like Adafruit, iConstrux, Spark Fun, Arduino and others all have components that are geared toward these nifty little devices. Adafruit, for example, sells the Nunchucky, which is a tiny little board that allows you to easily interface a Nintendo Wii Nunchuck controller. These controllers are, themselves, very cool and underrated. They feature accelerometers, a joystick and two buttons and are easily read by these little processors. And, with the Nunchucky, you do not need to cut its cable.

IMG_3070While it is old news, it is new news to me…the Arduino’s are capable of limited video generation and, hence, limited graphics. Now, while the graphics ability will never threaten nVIdia or AMD, they will give the aforementioned RCA Cosmac a run for its money. 

Armed with this knowledge, the Nunchuck/Nunchucky, some basic soldering skill and enough knowledge of electronics to be somewhat dangerous, I have set out to build that computer/game console.

I am actually doing two consoles: a handheld for my stepson and a somewhat more capable one as my exercise in designing and constructing said system. The handheld will utilize a small joystick, a Nokia 5110 LCD and a speaker in addition to the Mega328 Mini Pro.

Unfortunately, I ordered a great deal of my parts from eBay and just about all are shipping from China, apparently by foot as they have not all arrived.

IMG_3041However, since my Uno did arrive, I’ve been able to design and build the Half Byte game shield and start working on a prototype game, based on the Super Mario games. No, the game will not be made public, but, perhaps, a modified version with different characters may be. I do not have license to distribute any copyrighted material from Nintendo.

The game shield currently features the audio and video out connectors, the 1kohm and 470ohm resistors that allow the video to work (along with a library for the Arduino), the Nunchucky board, Arduino I/O pins and the header for the Parallax Serial LCD (which uses digital pin 2.) I may add digitized sound output as well and, perhaps, blinky LED’s and support for my custom three button controller.

arduinovideoThe tricky thing with the video is that it is all handled by the processor. The resistors ‘fool’ most televisions into ‘thinking’ there is a legit video signal. The 1k resistor handles the sync while the other handles the video itself. It was very easy to do and only involved the sacrifice of one video cable (and, since then, I acquired actual connectors so I can use better cables.)  Because the processor does all of the work, and has a very limited memory space (2k of ram, tops) the resolution is a paltry 120×96, though I had to back it down a bit to about 100×96, I needed a bit more ram. There is a common library, called TVOUT, available that most people use, though a few have written their own. The common library provides for three different fonts, lines, circles, inverse video and other niceties. It also can display bitmaps, though they MUST be correctly formatted and converting a bitmap for use is a bit of a pain. You must first resize the bitmap to fit the tiny screen, then you have to save it as a monochrome bitmap, process that file through another program that creates the hex codes that go into an array in the Arduino PROGRAM memory (NOT RAM, but the Flash memory that stores your code.) I’ll post more instructions in a later post.

proto Mario 1So, once I got the video and audio up and working, I played around with some code. First, the TVOUT demo then my own code. The TVOUT demo is pretty cool with a nice rotation sequence. It also displays the bitmap for the schematic to generate the video, an interesting inclusion.

My ‘mario’ game began as a demo. I wanted to move an image around, controlled by the Nunchuck. I wanted to use Spongebob, but I could never get him to look right in such low resolution. Now, how damned hard is it to represent a SPONGE? UGH.  Mario looked much more recognizable and that’s what I went with. Once I had my bitmaps done, moving them around was easy.  I now have Mario, a Koopa Troopa and a Warp Pipe in my level.  I am using another game called Poofy for some direction. Poofy is a side scroller for Arduino that uses some interesting methods and code that are in the public domain (and developed by the people who brought us Hackvision, an Arduino based console similar to what I am doing.)

My next step with the game is a scrolling world, Mario’s ‘weapon’ and a story.

I will be documenting the process, so stay tuned!

For quicker updates, follow Half-Byte on Facebook.

Links: