Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with Electronic Projects

You're reading from   Getting Started with Electronic Projects Build thrilling and intricate electronic projects using LM555, ZigBee, and BeagleBone

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781783554515
Length 176 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Testing and calibration


Now that we have our circuit built, it is time to test and calibrate it. In order to do that, I have provided you with simple JavaScript that you can use to read the input from AN0 on the BeagleBone:

var b = require('bonescript');
var inputPin = "P9_39";
loop();
function loop() {
  var value = b.analogRead(inputPin);
  var diff = value-0.667; //0dBm input
  console.log ("Value");
  console.log(value); //DAC Reading
  console.log("Difference");
  console.log(diff); //Difference between
  //current reading and 0dBm 
  console.log ("Power");
  console.log((diff/0.007)); // ~ 7% change per dBm
  setTimeout(loop, 1);
}

The preceding script outputs various calculations for calibration and debugging purposes. The first variable value is the raw input from the DAC. This value is a number between 0 and 1 that represents the percentage of the full-scale reading. So a reading of 0.667 means that the voltage in is 66.7 percent of 1.8 volts, or full scale. This can be confusing...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image