Arduino Development Board

ArDev completed

Recently I decided to try my hand at building another PCB.  This time i wanted an arduino atmega 328 board that i can conceivably use in any situation.

It started off with the idea of being just a microcontroller, its crystal, and all the pins broken out into headers.

A poor mans arduino without all the extras, saving on costs, when i just needed to do a simple task.

What i ended up with was a lot more than that..

Arduino DevBoard Schematic croppedAt first I just layed out the Atmega with its crystal and 2 caps. Then i thought I may as well add a voltage regulator and power cap as well.

Then I began to squeeze extras into the leftover board space. Before I knew it I had decided to create a board that had room for lots of peripherals but I wouldn’t necessarily populate the whole board if I didn’t need that function.

I had to choose what items to include and which were the best pins for them.  I chose based on sensors and peripherals i had used and was comfortable with.

Some pins are fixed such as the I2C bus, the serial pins and the programming pins. The PWM pins I kept for the mosfets, and the analog pins for the sensors.

board

I tried to cram as much into the board as I could,trying to organize it into a usable pattern, while keeping everything as close as I dared.  Somethings needed to be on the edge to be usable, and some things need to be reachable to the touch. In the end I did what I could and hoped it would be a useful PCB!

The board contains the following features!!

On board power regulator with a DC jack in, light dependant resistor, temperature thermistor, relay, piezo speaker, reset button, real time battery backed up clock,serial port, 2 buttons, 2 potentiometers, 2 LEDS, 2 servo ports, movement PIR sensor, 3 high power MosFets, 3 general purpose IO. All atmega pins and power supply pins are broken out to headers; power, mosfet and relay outputs are on screw terminal blocks. There is an ICSP programming header on board.

board on bag

I finished the schematic and layout of the board.  I sent off the designs to the board house.  The board has a few mistakes but on the whole I’m really happy with it.

The worst bodge is the battery holder which has the polarity back to front, I forgot that a button cell has the positive polarity on the outside of the case unlike normal cells. I was magically able to slide the cell holder over and solve the problem temporarily, so that was great. The mosfet jumper if used must be changed to a right angle though.

A lot of the polarities on the board are not marked, although a completed picture of the board makes assembly easy.

Board bodge

I paid for 10 boards at a little more than $2 each, then bought lots of parts at about $30 per board, so I could populate them. I decide to bag them all up individually and throw in a copy of the schematic and finished board picture with a few notes as well.

I thought I would give away a few kits to friends and throw a few up onto my blog shop for sale at the cost of parts only.
kits

The first thing i did when i got the boards, was put in the power system and check all the voltages, then i put the processor in with its crystal and caps. Then I uploaded a blink sketch and probed the led pin. After that all worked i just added parts one at a time testing each.  I wrote a test sketch for all the functions. ,So far I have written code for a number of different tasks with it, including a clock, a thermostat relay, a movement sensitive night light, an RGB controller, and a dimmable led driver.  There are many more things I will be using the board for in the future.bagged

 If I run another batch of boards, I will fix the backup battery polarity, the labelling, change the back art, and maybe add an LCD header.

Here is the schematic, feel free to contact me for the board files and any code I have.

Here is my first test sketch..

/*

Arduino Dev board

20 July 2013

Toby Robb

This is a test sketch for the Arduino Development board
NOTES:

You must enable the internal pullups for the buttons by setting as inputs then writing HIGH
The leds if fitted also require the pullups to be enabled

*/

// Includes

#include <Servo.h> // Include the servo library

// Defines

#define ldrPin A2 // Light dependant resistor pin on board.
#define thermistorPin A3 //Temperature thermistor pin on board.
#define ledPin 8 // Led pin High for one colour Low for another
#define speakerPin 4 // The onboard speaker pin
#define relayPin 2 // Pin for the relay
#define sparePin 13 //Spare pin breakout on board

#define dataPin A4 // The I2C bus DATA pin
#define clockPin A5 // The I2C CLOCK pin

#define pot1Pin A0 // Number 1 potentiometer on the board.
#define pot2Pin A1 // Number 2 potentiometer on the board.

#define button1Pin 7 // Button 1 pin
#define button2Pin 12 // Button 2 pin

#define gpio1Pin 5 // General Purpose Input/output 1 pin
#define gpio2Pin 6 // General Purpose Input/output 2 pin
#define gpio3Pin 11 // General Purpose Input/output 3 pin

#define mosfet1Pin 3 // Mosfet 1 drive pin
#define mosfet2Pin 9 // Mosfet 2 drive pin
#define mosfet3Pin 10 // Mosfet 3 drive pin

Servo servo1; // create servo object to control a servo
// a maximum of eight servo objects can be created
int servoPos = 0; // variable to store the servo position

void setup(){

// Setup the serial

Serial.begin(9600);
Serial.println(“Beginning Setup”);

// Set up the pins

pinMode(ldrPin, INPUT); // If the light sensor resistor is fitted
pinMode(thermistorPin, INPUT); // If the temperature sensor resistor is fitted
pinMode(ledPin, OUTPUT); // You MUST use this if the LED’s are fitted.
pinMode(relayPin, OUTPUT); // If the relay is fitted.
pinMode(speakerPin, OUTPUT); // If the speaker is fitted.
pinMode(pot1Pin, INPUT); // If the potentiometer is fitted
pinMode(pot2Pin, INPUT); // If the potentiometer is fitted
pinMode(button1Pin, INPUT); // If the button is fitted (write HIGH to enable pullups)
pinMode(button2Pin, INPUT); // If the button is fitted (write HIGH to enable pullups)
pinMode(mosfet1Pin, OUTPUT); // Mosfet 1 output
pinMode(mosfet2Pin, OUTPUT); // Mosfet 2 output
pinMode(mosfet3Pin, OUTPUT); // Mosfet 3 output

servo1.attach(11); // attaches the servo on pin 11 gpio 3 to the servo object

// default states
digitalWrite(ledPin, HIGH);
digitalWrite(dataPin, HIGH);
digitalWrite(clockPin, HIGH);
digitalWrite(relayPin, LOW);
digitalWrite(button1Pin, HIGH); // enables pullups for buttons
digitalWrite(button2Pin, HIGH); // enables pullups for buttons

servo1.write(0);
}

void loop(){

//beep the buzzer
Serial.println(“Beep”);
tone(speakerPin, 500); // begin tone at 1000 hertz
delay(150); // wait half a sec
noTone(speakerPin); // end beep

//flash the leds
Serial.println(“Flash the LED’s”);
for(int i = 0; i<=8; i++){
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
}

// Cycle the relay
digitalWrite(relayPin, HIGH);
Serial.println(“Relay ON”);
delay(1000);
digitalWrite(relayPin, LOW);
Serial.println(“Relay OFF”);

// Test the mosfets

Serial.println(“Mosfet 1 blink”);
digitalWrite(mosfet1Pin, HIGH);
delay(250);
digitalWrite(mosfet1Pin, LOW);

Serial.println(“Mosfet 2 blink”);
digitalWrite(mosfet2Pin, HIGH);
delay(250);
digitalWrite(mosfet2Pin, LOW);

Serial.println(“Mosfet 3 blink”);
digitalWrite(mosfet3Pin, HIGH);
delay(250);
digitalWrite(mosfet3Pin, LOW);

// Sweep the servo on GPIO 3

Serial.println(“Sweep the servo”);
for(servoPos = 0; servoPos < 180; servoPos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
servo1.write(servoPos); // tell servo to go to position in variable ‘servoPos’
delay(15); // waits 15ms for the servo to reach the position
}
for(servoPos = 180; servoPos>=1; servoPos-=1) // goes from 180 degrees to 0 degrees
{
servo1.write(servoPos); // tell servo to go to position in variable ‘servoPos’
delay(15); // waits 15ms for the servo to reach the position
}

// Print the value of the button states

Serial.print(“Button one state : “);
Serial.println(digitalRead(button1Pin));
Serial.print(“Button two state : “);
Serial.println(digitalRead(button2Pin));
delay(1000);

// Show the value of the LDR for a few seconds
for(int i = 0; i <=50; i++){
Serial.print(“The brightness : “);
Serial.println(analogRead(ldrPin));
}

//show the value of the temperature thermistor for a few seconds
for(int i = 0; i <=50; i++){
Serial.print(“The Temperature : “);
Serial.println(analogRead(thermistorPin));
}

// Print off the potentiometer value for a few seconds
for(int i = 0; i <=50; i++){
Serial.print(“Potentiometer one : “);
Serial.println(analogRead(pot1Pin));
}
for(int i = 0; i <=50; i++){
Serial.print(“Potentiometer two : “);
Serial.println(analogRead(pot2Pin));
}

delay(3000);

}

No Comments Yet.

Leave a comment