DevDuino Sensor Node – Part 1 – Programming the DevDuino

It took me far too long to get this working, but I finally did it: a small Arduino compatible board called “DevDuino” running on a CR2032 cell battery is sending temperature and battery voltage over the air to another Arduino board which records it. Sounds easy, doesn’t it? Well, it depends…:

  • which Arduino are you using?
  • how good is the documentation of the DevDuino?
  • what wires do you have available?
  • Do you have a ISP programmer for the DevDuino?
Looking back I learned a lot about electronics but it also cost me a lot of time and maybe this blog post can save you some. But first things first. 

Programming the DevDuino

A while back I ordered the DevDuino V1.2 from Seeedstudio and I was very excited when it arrived. Maybe I should have read the (probably with Google Translate) translated Wiki page here to realize that I needed something to program the DevDuino. One way is using an In-System-Programmer (or short ISP) which can be a dedicated tool or a simple Arduino board. I checked out my Arduino box and found a Duemilanove compatible board and a Leonardo compatible board. I decided to use the Leonardo as ISP which was the first mistake: the Leonardo has some specialties which you have to be aware of or you will waste a lot of time. To turn a regular Arduino board into an ISP you’ll have to upload a special sketch to it, then swith all the settings to the board you want to program and pick “Arduino as ISP” from the programmer menu. Then you’ll have to connect the target platform with your ISP-Arduino, which might require some female-female jumpers. To upload a sketch to your target platform (like the DevDuino in my case) you hold down Shift while pressing the “Upload” button in the Arduino IDE. This page describes the process for “regular” Arduino boards pretty well. If you happen to use a Leonardo as ISP, then this page might help you. In short: you’ll have to adapt the sketch you upload to your ISP by changing some pin definitions which are different for the Leonardo.
The wiring might also be different:
Source: Freetronics

So now you can send sketches to your DevDuino! If you want to save battery lifetime you can (and possibly should) adapt the settings for your target board. The DevDuino Wiki suggests to add the following lines to your boards.txt (on Mac OS X this might be here: 

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/boards.txt):

s328o1.name=Sensor328p (int1MHz, 1.8V)

s328o1.upload.protocol=arduino
s328o1.upload.maximum_size=30720
s328o1.upload.speed=19200

s328o1.bootloader.low_fuses=0x62
s328o1.bootloader.high_fuses=0xda
s328o1.bootloader.extended_fuses=0x06
s328o1.bootloader.path=atmega

s328o1.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex

#s328o8.bootloader.file=ATmegaBOOT_168_atmega328.hex

s328o1.bootloader.unlock_bits=0x3F
s328o1.bootloader.lock_bits=0x0F

s328o1.build.mcu=atmega328p
s328o1.build.f_cpu=1000000L
s328o1.build.core=arduino
s328o1.build.variant=standard

Then close the IDE and re-open it. Under Tools > Boards you can find now a board called “Sensor328p (int1MHz, 1.8V)”. Select it. I believe you have to update the bootloader on the DevDuino

Now lets test the DevDuino with a minimal sketch:

int led = 9;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

which will make the built-in LED blink on the DevDuino. To upload this sketch to the DevDuino make sure it is attached correctly to be programmed as shown above. Switch to the correct programmer on Tools > Programmer > Arduino as ISP (or similar, if you use a special board like Leonardo). Then select File > Upload using Programmer or hold the Shift key while pressing the Upload button of your sketch. After the status turns to “Done Uploading..” the LED on the DevDuino should start blinking…

This was part 1 of the DevDuino tutorial. Part 2 will go into more details…

Links:

Posted by Daniel Eichhorn

Daniel Eichhorn is a software engineer and an enthusiastic maker. He loves working on projects related to the Internet of Things, electronics, and embedded software. He owns two 3D printers: a Creality Ender 3 V2 and an Elegoo Mars 3. In 2018, he co-founded ThingPulse along with Marcel Stör. Together, they develop IoT hardware and distribute it to various locations around the world.

One comment

  1. Did you need to do anything to drop the voltage to 3.3V? The DevDuino wiki says you need to use 3.3V (not 5V), but as far as I know, most Arduino boards like the Leonardo push 5V?

Leave a Reply to PeterCancel reply