Skip to content

Commit 64c3d33

Browse files
committed
Version 1.0
Removed analog multiplexer for complexity reasons and commented flow current out.
1 parent e505ef1 commit 64c3d33

1 file changed

Lines changed: 4 additions & 37 deletions

File tree

Sensor-Arduino/Sensor-Arduino.ino

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,11 @@
1010
#define dataLinkRX 3
1111
#define dataLinkTX 4
1212

13-
14-
15-
// analog multiplexer control signals
16-
#define analogMuxS0 5
17-
#define analogMuxS1 6
18-
#define analogMuxS2 7
19-
20-
// analog multiplexer enable signal
21-
#define analogMuxE 8
22-
23-
// analog multiplexer data
24-
#define analogMuxData A5
25-
26-
2713
#define currentPhase1Pin A0
2814
#define currentPhase2Pin A1
2915
#define currentPhase3Pin A2
30-
#define flowCurrrentPin 0 // analog mux pin
31-
#define busVoltagePin 1 // analog mux pin
16+
// #define flowCurrrentPin A5
17+
#define busVoltagePin A5
3218

3319
#define flowSensorInterrupt 0 // 0 = digital pin 2
3420

@@ -172,11 +158,11 @@ boolean readSensorData() {
172158
break;
173159
case 3:
174160
// BUS Spannung
175-
sensorValue = (float)read4051AnalogPin(busVoltagePin);
161+
sensorValue = (float)analogRead(busVoltagePin);
176162
break;
177163
case 4:
178164
// Current Primary
179-
sensorValue = (float)read4051AnalogPin(flowCurrrentPin);
165+
sensorValue = 0; // (float)analogRead(flowCurrrentPin);
180166
break;
181167
case 5:
182168
// Temp PFC
@@ -289,22 +275,3 @@ float measureCurrent(byte analogPin) { // analogPin [0..7]
289275
}
290276
return 0;
291277
}
292-
293-
int read4051AnalogPin(int pin) {
294-
// select multiplexer input
295-
digitalWrite(analogMuxS0, pin & 1);
296-
digitalWrite(analogMuxS1, pin & 2 >> 1);
297-
digitalWrite(analogMuxS2, pin & 4 >> 2);
298-
299-
// enable
300-
digitalWrite(analogMuxE, LOW);
301-
delayMicroseconds(5);
302-
303-
// read value
304-
int val = analogRead(analogMuxData);
305-
306-
// disable
307-
digitalWrite(analogMuxE, HIGH);
308-
309-
return val;
310-
}

0 commit comments

Comments
 (0)