The project of B-OSC is consists of Arduino , Bluetooth module, voltage sensor and APP software.
The hardware of the project is as follows:
Arduino UNO;
Bluetooth module:HC-05;
Voltage sensor module(DIY by:7501=7.5k and 3002=30k resistors);
Dupont Lines。
- Schematic Diagram and Physical Map:
Fig.1 Schematic Diagram
Fig.2 Physical Map
2.Arduino source code:
UNO:
#include <SoftwareSerial.h>
SoftwareSerial BT(8,9);//8->HC-05 TXD 9->HC-05 RXD
int analogpin=A5; //电压值输入
int val;
float val1;
void setup() {
// put your setup code here, to run once:
//Serial.begin(9600);//调试用
//Serial.println("BLUETOOTH is ready!");
BT.begin(9600);//HC-05的波特率,太高了用软串口会有问题
}
void loop() {
val=analogRead(analogpin); //采集电压并赋给val
val1=val/40.92;
// Serial.print(millis()/1000.0,3);//调试用
//Serial.print(",");
// Serial.println(val1,2);
BT.print(millis()/1000.0,3);//数据格式:时间,电压值\n
BT.print(",");
BT.print(val1,2);
BT.print("\n");
// delay(5);//延时采集
}
- Software of APP
The App can connect to HC-05 by Bluetooth and collect the value of voltage。
The App can: adjusting scope, Time Periods, drawing scatter plot, line chart, Interpolating chart.
a)GUI of start
b)OSC GUI
Fig. 3 App GUI
4.Test
The test Waveform about 21V as Fig.3b).It is matched the theory waveform as Fig.4. The result is acceptable.
Fig.4 Theory Waveform
APP Source code:It is programmed by E4A and fit to Android System. Some as Fig.5.
Fig.5 Source Code
- Conclusion
5.1 The programm of App programs is harder than UNO code, because we must convert the data from bytes to float value。
5.2 the App can draw all data like “,\n” such as Temperature.