Arduino Command-line Tool "MiniPirate"




This command-line enables "Quick" Arduino prototyping without compilation. Reading analog values, dis-/enabling ports and even I2C register manipulations are done in seconds instead of minutes. I will shows you how to set the time of a "DS1207" I2C realtime clock as well as executing some basic operations.

The impatients of you just download the sketch here: [GitHub] and enter the test sequence "\a2/a3ir10" into the Arduino serial monitor.

The MiniPirate is heavily inspired by the much small and powerful "Bus Pirate" of Ian Lesnet and even uses a small part of it's code.

Please vote for the Arduino contest (top right of this page). The oscilloscope will improve the further developments.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: (optional) Wiring and Power-up (only for DS1307 Breakout)

The wiring is very trivial, just pluging the DS1307 real-time clock breakout to the pins A2-A5, leaving the "DS" pin in the air (From Homebrew Computers), please wait with the connection, until the pin power-up is verified. If you don't have a DS1307, just use any other I2C device you have.

The power will be supplied over the pins A2/A3:
- Download [GitHub] and Unzip
- Rename the directory to "MiniPirate"
- Compile and download the sketch on you Arduino
- Open the Serial Monitor in your Arduino IDE ("Tools -> Serial Monitor")

After opening the monitor the help and the first prompt should be displayed. Now we execute the first command. Just type 'p' and hit <enter> in the top line of the Serial Monitor. This will show the current configuration of all ports (INPUT and Floating values).

To set A2 to Ground and A3 to Vcc wie execute: \a2/a3 <enter> and control the result with 'p'. As we don't want to repeat this again and again, we save it with 'x'.

Now we can plug in the module as described above.

Step 2: I2C Scan, Read and Write

Assuming any I2C connected to the Arduino and powered up we will continue to detect it's address and the read/write some values.

D1. Type 'i' Tt check the devices currently connected. This will list the addresses of all devices on the bus (thanks to Krodal). In my case 0x50 is the EEPROM, 0x68 is the DS1307 real-time clock. The last address will be autoselected for the next operations.
D2. Type 'w0' to set DS1307 register access pointer to zero according to the specification
D3. Type 'r10 to read the first 10 registers

To be faster you can copy-paste this 'iw0r10' and all commands will be executed.

E1. type 'i' to scan the bus again (optinal)
E2. Type '0' to switch to the EEPROM on the breakout
E3. Type 'w 0 0' to select position zero of the EEPROM
E4. Type 'r20' to read 20 bytes
E5. Type 'w 0 0 0xff 0xee 0xab 0x12' to write some values.
E6. Type 'w 0 0 r 20' to verify this values.

To be faster you can copy-paste this 'i0w00r20w0 0 0xff 0xee 0xee 0xab 0x12w0 0r20' and all commands will be executed.

Step 3: I2C Write the Time in DS1307

Now let's try to programm the clock:

According to the specification we will write 13:45:56 on 30.12.2014 to the system.

1: 0x56 (Seconds)
2: 0x45 (Minutes)
3: 0x13 (Hours)

4: 0 (Day of the week)

5: 0x30 (Day)
6: 0x12 (Month)
7: 0x14 (Year)

'w 0 0x56 0x45 0x13 0 0x30 0x12 0x14'

Enjoy it and please vote for it on the Arduino contest if you like it.

Arduino Contest

Participated in the
Arduino Contest

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    16 Discussions


    5 years ago on Introduction

    I have wanted a command-line too for ages, you have saved me from doing all the boring tedious work that is required when one is testing/debugging componentry/circuitry, much appreciated.

    1 reply

    Thanks to GitHub, I found an previous revision that works for me {the link in this article wil not compile due to outdated libraries}

    Your GitHub link is downloading an obsolete version with the <WProgram.h> reference again


    4 years ago

    Can you show an example of testing a servo using this? I gather that it will use g 'set analog PWM' and s -set servo value'; but I have not figured it out. Thanks

    2 replies

    5 years ago

    If you have trouble compiling the code, go to the middle tab (baseIO.cpp and delete the line "#include<WProgram.h>"; me thinks it is an obsolete library)

    2 replies

    Reply 4 years ago

    This was used in very old Arduino versions. I will add the 'ifdef' required.


    5 years ago on Introduction

    Sadly, the code does not compile.
    Ofcourse it first stops at the WProgram.h, fixed that by changing into Arduino.h

    But then subsequently there is an entire page with errors that mostly have to do with 'double declaration' doesnt work on 1.0 nor 1.05.
    Too bad

    5 replies

    Reply 5 years ago on Introduction

    Hmm I think I got the problem. For some reason the IDE, upon loading the program, also laods the baseIO.cpp and .h file.
    If I copy the code to a blank IDE and close the loaded code, it will compile .
    Odd, very odd


    Reply 5 years ago on Introduction

    OK, the problem is caused because the MiniPirate.ino is situated in the MiniPirate library folder.
    The solution is to create an 'examples\MiniPirate' folder in the libraries\MiniPirate folder and put the ino file there