Arduino Teaches Old Coder New Tricks

I became aware of the Arduino Project from occasional media reports and a presentation at Atlanta LinuxFest 2009. I was impressed with what the Arduino community was doing, but at that time, I saw no personal use for it. It took a grandson who is heavily involved in a high-school competitive robotics program to change things for me. During a 2011 Thanksgiving family gathering, he asked me some questions about robotics-related electronics, and I told him to google Arduino. He did. Arduino ended up on his Christmas list, and Santa delivered.

I would be more helpful in assisting the grandson's Arduino efforts if I understood more about it myself, so I ordered a couple Arduino Nanos and some peripherals, such as rotors, servos, ultrasonic sensors and LCD displays, and dug in. I now had a purpose for using the Arduino and a reason to dust off my soldering iron. I used a breadboard for testing, as shown in Figure 1.

Figure 1. Arduino Pro Mini in Breadboard Tests

It didn't take very long to remove the mental cobwebs and get into the elegant simplicity of the Arduino Project. Years ago, when I built microprocessor projects, the underlying system code always was the problem. Before I actually could write my application, I had to develop or adapt systems-level code to interface the application-level code with the underlying hardware. It was always a major pain and, quite frankly, drudgery. The Arduino Project does away with worrying about most of the low-level systems code, leaving you with the now much-simplified task of creating your application. Using the Arduino IDE and included or contributed libraries enables you to interface to a plethora of hardware easily. Anyone who has developed in the C and C++ languages will find the Arduino platform easy to master quickly. Although Arduino is actually based upon the Wiring Project, compatibility with C, C++ and Linux are very high.

After implementing and testing code for the various peripherals that I had accumulated and generally mastering the Arduino platform, I said to myself, "now what?" So, I abandoned the nice Arduino IDE and switched over to developing code using Linux tools, such as Make. I also wanted to get closer to the hardware, so I abandoned the Arduino boards and did my implementations on the underlying ICs used by all Arduino boards, the Atmel 8-bit series of microcontrollers. Using the Arduino libraries with the Atmel microcontrollers is a joy to behold. I am so thrilled that the drudgery of systems code can be mostly ignored as it is mainly handled by the hardware abstraction features of Arduino's built-in libraries. It is important to note that the Atmel ICs are microcontrollers, not microprocessors. In other words, they are almost complete computers equipped with RAM, EPROM and FLASH memory, multidirectional I/O, serial ports (in some cases) and interface circuitry (such as pull-up resistors and so on). Just adding a power source will yield a computer in a chip.

The hardware's interfaces of the Atmel microcontroller are abstracted by Arduino in a uniform way—at least, uniform for those Atmel micrcontrollers implemented by the Arduino group. Arduino libraries use internal code, generically called the "core", to define the available I/O pins on a given Atmel microcontroller, assigned by pin number. For example, the Atmel ATMega168 physical pin 4 is defined as Arduino I/O pin 2, yet with the Atmal ATMega32u4 microcontroller, the same Arduino pin 2 is matched to physical pin 19. Thus, the Arduino syntax of "pinMode(2, OUTPUT)" defines, in software, an abstracted hardware pin as a digital output. Because the Arduino module pins are labeled with Arduino pin numbers, the abstraction becomes physical, at least on the module level. Nonetheless, it is this abstraction as well as robust libraries that enable the Arduino to be so easy to work with. One caveat alluded to above is that Atmel microcontrollers not implemented in Arduino modules don't have uniform core definitions—for example, the Atmel Attiny series. You still can use the Arduino libraries and tools, but the cores must be obtained elsewhere. For the Atmel ATtiny85 and Attiny 84 microcontrollers, I use the core from the code.google project named arduino-tiny. However, there are other, competing cores around for these chips, and they are not necessarily compatible.

Burning your program into an Arduino module is extremely easy to accomplish. The USB connection not only can power the module as well as serve as the serial communications interface, but the Arduino IDE also uses it to install your program into the Flash memory. It is more complex with the Atmel ATtiny series, because they have no USB port or even a hardware serial port, for that matter. For the ATtiny series, you must use an external programmer. Many people use an Arduino board as the programmer once they have loaded the ArduinoISP software, or sketch, as programs are named in the Arduino world. In my case, I chose to use a dedicated programmer called a USBasp. It is readily available on eBay, or you even can make your own with plans from its creator, Thomas Fischl. I purchased mine on eBay because it was cheaper than the parts cost to make my own. The USBasp uses the open-source AVRdude software.

______________________

Edward Comer is retired from the telecommunications industry, having worked for the real AT&T, BellSouth and Numerex Corp during a 30-year career.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

medical assistant

sajukhann0n's picture

Medical Assistant programs and medical assistant classes are now online at St. Augustine School of Medical Assistants.

Now offers a nationally accredited and certified medical assistant program online.

St. Augustine School of Medical Assistants is a provider of online medical assistant programs and medical assistant courses.

Thank you for teaching us

Jasa kontes's picture

Thank you for teaching us this trick. This trick is very useful.
Jasa SEO

You stirred my curiosity

Hosting Dude's picture

You really did. Never been interested in playing with hardware stuff. Been a web developer for years, never looked into hardware programming and Arduino and stuff like this. Now I want to learn it lol

Good writeup on this, keep up the good work mate

Cheers,
Hosting Dude

I want to learn Arduino

tempo's picture

I want to learn Arduino projects. maybe by reading this article can help me. tempo

medical assistant job

Anonymous's picture

Check out: medical assistant

Anonymous's picture

Thanks for share this

terbaru's picture

Thanks for share this article. I think Arduino projects is amazing. berita Indonesia

Nice one

RUSH PCB UK's picture

Thanks for sharing your ideas and thoughts, i like your blog and bookmark this blog for further use thanks again…

It didn't take very long to

Anonymous's picture

It didn't take very long to remove the mental cobwebs and get into the elegant simplicity of the Arduino Project. Years ago, when I built microprocessor projects, the underlying system code always was the problem. Before I actually could write my application, I had to develop or adapt systems-level code to interface the application-level code with the underlying hardware. Cleaners London

hello

samatha0045's picture

I discovered your blog so far ... much information to improve our space! So thank you and have a nice day!
voyance en direct

The link to the source code

Anonymous's picture

The link to the source code and design schematics just refers to the google code homepage :)

Nice!

Karl A.'s picture

What a great article!
Are you familiar with Instructables.com? They have many Arduino projects. I think this would be a great submission.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState