The ForceTronics blog provides tutorials on creating fun and unique electronic projects. The goal of each project will be to create a foundation or jumping off point for amateur, hobbyist, and professional engineers to build on and innovate. Please use the comments section for questions and go to forcetronics.com for information on forcetronics consulting services.
Showing posts with label BLE. Show all posts
Showing posts with label BLE. Show all posts
Wednesday, November 9, 2016
Unboxing the Anaren A20737A BLE Module and Atmosphere IDE
In this video we take a look at Anaren's A20737A BLE Module and the innovative Atmoshere IDE. If you want to try out the IDE for yourself before investing in the hardware use the following link: https://atmosphere.anaren.com/
Tuesday, August 11, 2015
Building Your Own AVR / Arduino Internet of Things (IoT) Development Board Part 5
Welcome to the final installment of building your own AVR / Arduino compatible internet of things (IoT) development board. In part 5 we open up our new PCBs and build them up. We then do some testing to make sure everything is working correctly. Spoiler alert, this video has a happy ending with a working Arduino compatible board with Bluetooth 4.0 built-in. Below you will find a link to the Eagle files and the Arduino code for the test sketch.
Link to download Eagle files including: library file, project files, and Gerber files:
https://dl.dropboxusercontent.com/u/26591541/AVR_IoT_Board_Eagle_Files_8_8_15.zip
*******************Arduino Test Sketch************************************
//This sketch is to test a DIY Arduino compatiable board with Bluetooth 4.0 on it
//the board is targeted IoT applications. Details can be found of the ForceTronics
//YouTube channel. This code is open for anybody to use and modify
int wValue = 1; //variable to hold write value (high or low)
void setup() {
Serial.begin(115200); //start serial
}
void loop() {
delay(1000);
setPinMode(OUTPUT, INPUT); //set D2 to D7 as outputs, and D8 to D13 to inputs
setDigWrite(false, wValue); //set group of pins to write and write high or low
Serial.print("D2 thru D7 writing ");
Serial.println(wValue);
Serial.println("D8 thru D13 reading the following values....");
printDigPins(true); //print what dig pins read
delay(1000);
setPinMode(INPUT, OUTPUT); //set D2 to D7 as intputs, and D8 to D13 to outputs
setDigWrite(true, wValue); //set group of pins to write and write high or low
Serial.print("D8 thru D13 writing ");
Serial.println(wValue);
Serial.println("D2 thru D7 reading the following values....");
printDigPins(false); //print what dig pins read
delay(1000);
adcReads(); //read each ADC pin and print result
if(wValue) wValue = 0; //toggle digital write value
else wValue = 1;
delay(1000);
}
//function sets D2 thru D7 to input / output and D8 thru D13 to input / output
void setPinMode(int smallMode, int bigMode) {
for(int i=0;i<6;i++) {
pinMode((i+2), smallMode);
pinMode((i+8), bigMode);
}
}
//Writes high or low to group of digital pins
void setDigWrite(bool big, int state) {
if(big) {
for(int i=0;i<6;i++) {
digitalWrite((i+8), state);
}
}
else {
for(int i=0;i<6;i++) {
digitalWrite((i+2), state);
}
}
}
//does digital read on group of digital pins and prints results
void printDigPins(bool big) {
if(big) {
for(int i=0;i<6;i++) {
Serial.print("Value at pin D");
Serial.print((i+8));
Serial.print(" --> ");
Serial.println(digitalRead((i+8)));
}
}
else {
for(int i=0;i<6;i++) {
Serial.print("Value at pin D");
Serial.print((i+2));
Serial.print(" --> ");
Serial.println(digitalRead((i+2)));
}
}
}
//Reads each ADC pin and prints result
void adcReads() {
for(int i=0; i<6; i++) {
Serial.print("ADC value at Pin A");
Serial.print(i);
Serial.print(" --> ");
Serial.println(analogRead(i));
}
}
Link to download Eagle files including: library file, project files, and Gerber files:
https://dl.dropboxusercontent.com/u/26591541/AVR_IoT_Board_Eagle_Files_8_8_15.zip
*******************Arduino Test Sketch************************************
//This sketch is to test a DIY Arduino compatiable board with Bluetooth 4.0 on it
//the board is targeted IoT applications. Details can be found of the ForceTronics
//YouTube channel. This code is open for anybody to use and modify
int wValue = 1; //variable to hold write value (high or low)
void setup() {
Serial.begin(115200); //start serial
}
void loop() {
delay(1000);
setPinMode(OUTPUT, INPUT); //set D2 to D7 as outputs, and D8 to D13 to inputs
setDigWrite(false, wValue); //set group of pins to write and write high or low
Serial.print("D2 thru D7 writing ");
Serial.println(wValue);
Serial.println("D8 thru D13 reading the following values....");
printDigPins(true); //print what dig pins read
delay(1000);
setPinMode(INPUT, OUTPUT); //set D2 to D7 as intputs, and D8 to D13 to outputs
setDigWrite(true, wValue); //set group of pins to write and write high or low
Serial.print("D8 thru D13 writing ");
Serial.println(wValue);
Serial.println("D2 thru D7 reading the following values....");
printDigPins(false); //print what dig pins read
delay(1000);
adcReads(); //read each ADC pin and print result
if(wValue) wValue = 0; //toggle digital write value
else wValue = 1;
delay(1000);
}
//function sets D2 thru D7 to input / output and D8 thru D13 to input / output
void setPinMode(int smallMode, int bigMode) {
for(int i=0;i<6;i++) {
pinMode((i+2), smallMode);
pinMode((i+8), bigMode);
}
}
//Writes high or low to group of digital pins
void setDigWrite(bool big, int state) {
if(big) {
for(int i=0;i<6;i++) {
digitalWrite((i+8), state);
}
}
else {
for(int i=0;i<6;i++) {
digitalWrite((i+2), state);
}
}
}
//does digital read on group of digital pins and prints results
void printDigPins(bool big) {
if(big) {
for(int i=0;i<6;i++) {
Serial.print("Value at pin D");
Serial.print((i+8));
Serial.print(" --> ");
Serial.println(digitalRead((i+8)));
}
}
else {
for(int i=0;i<6;i++) {
Serial.print("Value at pin D");
Serial.print((i+2));
Serial.print(" --> ");
Serial.println(digitalRead((i+2)));
}
}
}
//Reads each ADC pin and prints result
void adcReads() {
for(int i=0; i<6; i++) {
Serial.print("ADC value at Pin A");
Serial.print(i);
Serial.print(" --> ");
Serial.println(analogRead(i));
}
}
Labels:
4.0,
arduino,
Atmega 328,
Atmel,
avr,
BLE,
BLE Micro,
Bluetooth,
Eagle,
internet of things,
IoT,
PCB,
Tutorial
Friday, July 10, 2015
Building Your Own AVR / Arduino Internet of Things (IoT) Development Board Part 4
This is part 4 in a 5 part series where we build our own AVR / Arduino Internet of Things (IoT) development board, yay! In this part we will do the PCB layout and discuss how to get our PCB manufactured.
Download Eagle Files
Libraries Used:
•Atmega 328P --> Library: SparkFun-DigitalIC Device: ATMEGA328P_PDIP
•LM317 --> Library: linear>*317 Device:317T
•Resonator ZTT16.0MHz --> Library: Adafruit Device: CERMOSCILL-THM (CERMOSCILL)
•Ceramic Cap --> Library: rcl > C-EU Device: C-EU050-030X075
•Electrolytic cap --> Library: rcl > CPOL-EU Device: CPOL-EUE2.5-6
•Resistor --> Library: resistor Device: R-EU_0207/10 (R-EU_) Package: 0207/10
•Reset switch --> Library: switch-omron Device: 10-XX
•LED --> Library: led Device: LED5MM (LED)
•Potentiometer --> Library: rcl > R-TRIMM Device: R-TRIMMT93YA
Note: Sparkfun and Adafruit libraries did not come with Eagle, but you can find them on their websites
Parts I made (included in files linked to my blog):
•ForceTronic.lbr --> All header and pin holes and 2.1mm DC Jack
•BLE_Micro_Module.lbr --> BLE Micro
Monday, July 6, 2015
Building Your Own AVR / Arduino Internet of Things (IoT) Development Board Part 3
This is part 3 in a 5 part series where we build our own AVR / Arduino Internet of Things (IoT) development board, yay! In this part we will finalize our design schematic and parts list so we are ready to do PCB layout in part 4.
Final Design Schematic:
Bill of Materials:
Final Design Schematic:
Bill of Materials:
- Atmega 328P MCU (Dip Package)
- 16MHz resonator
- BLE Micro from DFRobot or equivalent
- LM317 Voltage Regulator
- Resistors (Ohms): 10k, 2x 1k, 2x 300, 1k POTENTIOMETER or 500
- Capacitors: 4x 100nF (Ceramic) and 1uF (electrolytic)
- LED 5mm (any color you want)
- 0.1” male pins
- 2x 0.1” 2x4 female header (optional)
- 4x 0.1” pin jumpers
- DC Power Jack (+ pin is 2.1mm)
- 13uH Inductor (optional)
- Female pin headers: 6 pin, 2x 8 pin, 10 pin
- 28 pin DIP Socket (optional): part # 4828-3004-CP
Wednesday, June 17, 2015
Building Your Own AVR / Arduino Internet of Things (IoT) Development Board Part 2
This is part 2 in a 5 part series where we build our own AVR / Arduino Internet of Things (IoT) development board, yay! In this part we add the Arduino bootloader to our Atmega 328p as well as build and test a prototype of our design.
BLE Micro Shield Eagle Files 1.0 version (use at your own risk):
https://dl.dropboxusercontent.com/u/26591541/BLE%20Shield.zip
//*******************Arduino Code**********************************************
/*
This sketch is part of a video tutorial on the ForceTronics YouTube Channel for Building Your AVR/Arduino IoT Development Board
which uses a Atmega 328p and a Bluetooth low energy module.
The bluetooth module is connected to an Arduino and the Arduino is connected to an LED.
This code is in the public domain.
*/
// Pin 13 has a LED connected to it
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(115200);
// initialize the digital pin as an output and set it low initially
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
}
// the loop routine runs over and over again forever:
void loop() {
delay(30);
String t; //create an empty string to store messages from Android
while(Serial.available()) { //keep reading bytes while they are still more in the buffer
t += (char)Serial.read(); //read byte, convert to char, and append it to string
}
if(t.length()) { //if string is not empty do the following
if(t == "on") { //if the string is equal to "on" then turn LED on
digitalWrite(led, HIGH); //Set digital pin to high to turn LED on
Serial.write("LED is on"); //Tell the Android app that the LED was turned on
}
else if (t == "off") {
digitalWrite(led, LOW);
Serial.write("LED is off");
} // turn the LED off by making the voltage LOW
}
}
BLE Micro Shield Eagle Files 1.0 version (use at your own risk):
https://dl.dropboxusercontent.com/u/26591541/BLE%20Shield.zip
//*******************Arduino Code**********************************************
/*
This sketch is part of a video tutorial on the ForceTronics YouTube Channel for Building Your AVR/Arduino IoT Development Board
which uses a Atmega 328p and a Bluetooth low energy module.
The bluetooth module is connected to an Arduino and the Arduino is connected to an LED.
This code is in the public domain.
*/
// Pin 13 has a LED connected to it
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(115200);
// initialize the digital pin as an output and set it low initially
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
}
// the loop routine runs over and over again forever:
void loop() {
delay(30);
String t; //create an empty string to store messages from Android
while(Serial.available()) { //keep reading bytes while they are still more in the buffer
t += (char)Serial.read(); //read byte, convert to char, and append it to string
}
if(t.length()) { //if string is not empty do the following
if(t == "on") { //if the string is equal to "on" then turn LED on
digitalWrite(led, HIGH); //Set digital pin to high to turn LED on
Serial.write("LED is on"); //Tell the Android app that the LED was turned on
}
else if (t == "off") {
digitalWrite(led, LOW);
Serial.write("LED is off");
} // turn the LED off by making the voltage LOW
}
}
Sunday, June 7, 2015
Intro to Bluetooth Low Energy (BLE) and the BLE Micro
In this video we will take a look at Bluetooth Low Energy or Bluetooth Smart and compare it to classic Bluetooth. From there we will look at how to get started with the BLE Micro module and look at how to communicate with it from an iOS device and another BLE Micro Module.
************************Arduino Code****************************************
/*
This sketch is part of a video tutorial on the ForceTronics YouTube Channel for using the BLE Micro module which uses Bluetooth low energy.
The bluetooth module is connected to an Arduino and the Arduino is connected to an LED.
This code is in the public domain.
*/
// Pin 7 has a LED connected to it
int led = 7;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(115200);
// initialize the digital pin as an output and set it low initially
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
}
// the loop routine runs over and over again forever:
void loop() {
delay(30);
String t; //create an empty string to store messages from Android
while(Serial.available()) { //keep reading bytes while they are still more in the buffer
t += (char)Serial.read(); //read byte, convert to char, and append it to string
}
if(t.length()) { //if string is not empty do the following
if(t == "on") { //if the string is equal to "on" then turn LED on
digitalWrite(led, HIGH); //Set digital pin to high to turn LED on
Serial.write("LED is on"); //Tell the Android app that the LED was turned on
}
else if (t == "off") {
digitalWrite(led, LOW);
Serial.write("LED is off");
} // turn the LED off by making the voltage LOW
}
}
************************Arduino Code****************************************
/*
This sketch is part of a video tutorial on the ForceTronics YouTube Channel for using the BLE Micro module which uses Bluetooth low energy.
The bluetooth module is connected to an Arduino and the Arduino is connected to an LED.
This code is in the public domain.
*/
// Pin 7 has a LED connected to it
int led = 7;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(115200);
// initialize the digital pin as an output and set it low initially
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
}
// the loop routine runs over and over again forever:
void loop() {
delay(30);
String t; //create an empty string to store messages from Android
while(Serial.available()) { //keep reading bytes while they are still more in the buffer
t += (char)Serial.read(); //read byte, convert to char, and append it to string
}
if(t.length()) { //if string is not empty do the following
if(t == "on") { //if the string is equal to "on" then turn LED on
digitalWrite(led, HIGH); //Set digital pin to high to turn LED on
Serial.write("LED is on"); //Tell the Android app that the LED was turned on
}
else if (t == "off") {
digitalWrite(led, LOW);
Serial.write("LED is off");
} // turn the LED off by making the voltage LOW
}
}
Tuesday, June 2, 2015
Building Your Own AVR / Arduino Internet of Things (IoT) Development Board Part 1
In this 5 part video series we will build our own AVR / Arduino Internet of Things (IoT) development board. We will go from a design concept to prototyping our design to PCB layout of our design all the way to a tested and finished development board.
Example parts order for this project (please note that this does not include all the parts)
Example parts order for this project (please note that this does not include all the parts)
Subscribe to:
Posts (Atom)



