Stap 2: Arduino code
De volgende code uploaden naar je arduino:
/*Simple Voltmeter Copyright 2013 Pavlos Iliopoulos, techprolet.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //set reference voltage; float refVcc = 5.0; // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.print("Analog read: "); Serial.println(sensorValue); // print out the converted (voltage) value Serial.print ("Voltage: "); Serial.print (sensorValue*refVcc/1024); Serial.println ("V"); Serial.println("--------------------"); delay(1000); // delay a whole second before reading again }
Van uw LiPo huidige SAP is twee keer de lezing krijg je van de Arduino (Vergeet niet dat wij de spanning gehalveerd voordat meten)
U kunt ook 3S LiPos (11.1V) meten door spanning door 3, 4S LiPos (14.8V) te delen door het delen door 4 enz.
Dit is het, geniet van uw nieuwe LiPo voltmeter!
Het beste ding is, je Arduino een heleboel andere dingen kunt doen terwijl het ook toezicht houden op uw LiPo!
Referentie:
[1] arduino analogReference