Saturday, April 4, 2015

Arduino Pro Mini (ATMega 328 Based), my New Toy

I saw it at electronic part shop while shopping for my DIY guitar preamp part. It based in ATMega 328 and it waking up my years-sleeping microcontroller spirit :D

I always love assembly language, I have several project on ATMega based microcontroller as programmer but it's just that. I just love programming without bothered by hardware, minsys or whatnot.

It's true that arduino language is not asm; it's simplified C. But it come in package, I just have to program it and it'll work. It's the closest thing I got to hardware related interface, for now (I still have a plan that some day I'll master both microcontroller hardware and software interfacing :) )

Anyway, I bought this Arduino Pro Mini and an USB to TTL module.



It just my luck that I bought that PL2303HX module and not Sparkfun breakout board or FTDI connector as my Arduino Pro Mini  layout is totally different; it has same dimension as original but the hole for pins is different (it has more hole than the original). The breakout board probably won't match and maybe useless (I don't konw about FTDI). So I think the pl2303hx usb to ttl usb-stc-isp is my best shot.

My luck, or probably not, it means my Arduino Pro mini is the clone, :)

I download Arduino IDE for my MacBook Air with OS X Yosemite. 

Install it, there's no problem as I changed my macbook setting on software installer permission (set to ANY)

Ran the IDE, use the example code, blinking LED.

compile it, OK

Upload it, this error message appear:

Arduino: 1.6.2 (Mac OS X), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

Sketch uses 1,068 bytes (3%) of program storage space. Maximum is 30,720 bytes.

Global variables use 11 bytes (0%) of dynamic memory, leaving 2,037 bytes for local variables. Maximum is 2,048 bytes.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.


Install FTDI drivers, not work, obviously because I don't use it.8

try it in my Linux Debian machine (after install it via sudo apt-get install arduino command), success

back to mac, success too, strange

After several success and error upload, it turned out that my tx rx connection is not thigh enough, heheh...

The pictures below made after I secure the connection by permanently solder it. Not my actual plan because initially I prefer it in plug and play form.

Some note

Make sure that PL2303HX and Arduino have this connection right
Vcc to 5V
GND to GND
TX to RX
RX to TX

Before clicking upload button on IDE, we have to press and hold reset button on Arduino board and release about one second after it (or after console displaying message: 'sketch size...').












I've found new kind of error like this

Arduino: 1.6.2 (Mac OS X), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

Sketch uses 4,480 bytes (14%) of program storage space. Maximum is 30,720 bytes.
Global variables use 216 bytes (10%) of dynamic memory, leaving 1,832 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can't open device "/dev/cu.usbserial": Resource busy
ioctl("TIOCMGET"): Inappropriate ioctl for device
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

It happened when I open serial monitor using Terminal apps on OS X and trying to upload the sketch while it running command

$ screen /dev/cu.usbserial

or 

$screen /dev/cu.HC-05-DevB

We have to close it first (not just detach) using command

$<ctrl>-a-\

and all is well, :)