Understanding two circuit diagrams and designing the missing perfboard section - Page 1
Forum section: electronics / projects

author: thanks
author_rank: Newbie
timestamp: April 30, 2025, 03:39:12 pm
content: Hi, could someone help me with this circuits?I would appreciate if someone could explain:1. What voltage levels (in V) are present at different test points throughout the circuit?2. What signal forms/waveforms would I expect to see at various points in the circuit?3. How do the individual sections of this circuit function?4. How does the complete system work together? What is its overall purpose?5. Can someone explain what types of voltage waveforms are expected at the inputs and outputs (square, triangle, sine, etc.) and how these signals are processed within the circuit? Please consider that this circuit includes a microcontroller (Arduino) controlled by a program. Regarding the perfboard section that's missing from the circuit diagram: what components would you recommend using to create a functional implementation? I've included a table below the two images listing the components that must be used for this perfboard section.Under the images you can see the Circuit/Function Description, the Arduino code is there also.Circuit/Function DescriptionUnless otherwise indicated, the reference measurements refer to construction group A1. The circuit is controlled by a microcontroller unit. An external control panel with an illuminated LCD display (16 × 4, dot matrix) and three buttons is used for control (construction group A14). The power supply is provided via a hollow plug (5.5 mm/2.1 mm, plug inner pin) with 12 V.Tunnel MonitoringThe simulation of tunnel monitoring should fulfill the following tasks:The temperature (LM75) should be monitored via different measuring points. The exhaust measurement in the tunnel is simulated via an adjustable resistor. Turning the fans on and off is achieved via the respective jumpers. The values for temperature measurement and exhaust are readable in the LCD display. A traffic light control regulates the traffic of passing vehicles.Temperature:In the LCD display of construction group A14, the three temperatures are shown. When pressing A14.S1, the heating elements are switched through the measuring points in sequence. If A14.S1 is pressed for the fourth time, all heating elements are switched off. An LED indicates the switching on and off of the heating elements. The heating functions are switched off via A14.S2. When a temperature of 32 °C is reached at the respective measuring point, an LED lights up, and "ALARM" appears behind the temperature in the LCD display. The tunnel is only used in one direction via the traffic light system. If the temperature falls below 28 °C again, both traffic lights turn green, the LED goes out, and the LCD display shows the measured temperature with "OK".Exhaust gases in the tunnel are measured via a potentiometer resistance.This value is displayed on the LCD display (for example, "EXHAUST 15% OK"). If the value exceeds 25%, the "OK" behind the exhaust value disappears. The tunnel is blocked via the traffic light system, also for one-way traffic. If the exhaust value exceeds 65%, the tunnel is closed. The display shows both. The LCD display shows: "EXHAUST 65% ALARM". If the exhaust values fall below 65%, the traffic lights still switch to red for a few seconds before allowing traffic again.LCD Display Examples:[Then there are several example LCD screen displays showing temperature and exhaust readings with various status indicators including "OK" and "ALARM" states]The two fans for ventilating the tunnel are activated via the respective jumpers.The fans blow out the exhaust gases and temperature.The Arduino code:Code:#include <Wire.h>#include <math.h>#include <LiquidCrystal.h>// defines#define TEMPADDRESS 0x48 // Baseadress first LM75#define TRAFFICLIGHTS 0x3F // Expander Traffic lights#define TEMP 0 // Temp register#define UNTEN 2 // Lower threshold#define OBEN 3 // Upper threshold#define LCD_OFFSET 0 // 4 for 20 x 4 Character// define thresholds#define uTEMP 28#define oTEMP 32#define uGAS 15#define mGAS 25#define oGAS 65// define INPUTs & OUTPUTs#define LCD_D7 2#define LCD_D6 3#define LCD_D5 4#define LCD_D4 5#define SWITCH_1 6#define SWITCH_2 7#define F_BUZZER_1 9 // BUZZER Temp#define F_BUZZER_2 8 // BUZZER Gas#define L_GAS 10 // FAN Gas#define L_TEMP 13 // FAN Temp#define LCD_E 11#define LCD_RS 12#define H_TEMP1 A1 // HEATER Temp 1#define H_TEMP2 A2 // HEATER Temp 2#define H_TEMP3 A3 // HEATER Temp 3LiquidCrystal lcd(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7);// ==============================================================// Functionsint checkStatus(int opt);void signalGoGreen(int opt);void signalGoRed(int opt);int receive_sensor(int opt);void output(void);void traffic_signal(int opt);void buzzerout(void);int pushS1(int heating);int pushS2(int heating);// LM75double get_LM75_temperature(int device, int regx);void set_LM75_config(int device, byte value);byte get_LM75_config(int device);void set_LM75_threshold(int device, byte regx, double grad);// Output expander (Input of D/A Converter)void sendDigitalValue(byte ADDR, byte value);// global variableschar dataString; // read temperature processed as a string: (-xx)x.xint status = 0, toChange = true, memStatus = 0, counter_switch = 0, toggle = 0;unsigned long timestamp = 0, timestampgas = 0, changetones = 0;void setup() {// put your setup code here, to run once:Serial.begin(9600);while (!Serial);Serial.println("\nProgram transfer complete!");Serial.println("You can unplug the uno!");Serial.end();Wire.begin();// Set IO-Pinsfor (int i = 2; i < 13; i++) {if (i == SWITCH_1 || i == SWITCH_2) {pinMode(i, INPUT);} else {pinMode(i, OUTPUT);digitalWrite(i, LOW);}}pinMode(H_TEMP1, OUTPUT);pinMode(H_TEMP2, OUTPUT);pinMode(H_TEMP3, OUTPUT);for (int i = 0; i < 3; i++) {set_LM75_threshold(i, OBEN, oTEMP);set_LM75_threshold(i, UNTEN, uTEMP);}}void loop() {int traffic = 0x00;while (1) {counter_switch = pushS1(pushS2(counter_switch));for (int i = 0; i < 4; i++, buzzerout())receive_sensor(i);traffic = checkStatus(traffic);}}//Functionsvoid buzzerout(void) {if (!memStatus) {delay(20);digitalWrite(F_BUZZER_1, LOW);digitalWrite(F_BUZZER_2, LOW);return;}changetones = (!changetones ? millis() : changetones);if (changetones < millis() - 500) {changetones = 0;toggle = !toggle;}if ((status & 0b00000111) || bitRead(status, 4))digitalWrite(F_BUZZER_1, ((bitRead(status, 4) || bitRead(status, 3)) ? toggle : HIGH));elsedigitalWrite(F_BUZZER_1, LOW);if (bitRead(status, 4) || bitRead(status, 3))digitalWrite(F_BUZZER_2, ((status & 0b00000111) || bitRead(status, 4) ? !toggle : HIGH));elsedigitalWrite(F_BUZZER_2, LOW);return;}int checkStatus(int opt) {if (toChange) {toChange = false;if (bitRead(status, 4)) {if (!opt) signalGoRed(0);else if (opt == 0x0F) signalGoRed(4);else if (opt == 0xF0) signalGoRed(2);return 0xFF;} else if (bitRead(status, 5)) {if (opt == 0x00) signalGoRed(1);else if (opt == 0xFF) signalGoGreen(1);return 0x0F;} else if (!status) {if (opt == 0xFF) signalGoGreen(0);else if (opt == 0x0F) signalGoGreen(1);else if (opt == 0xF0) signalGoGreen(3);return 0;}} else if (opt == 0x0F && bitRead(status, 5)) {signalGoRed(4);signalGoGreen(2);return 0xF0;} else if (opt == 0xF0 && bitRead(status, 5)) {signalGoRed(2);signalGoGreen(4);return 0x0F;}return opt;}void output(void) {lcd.home();lcd.print("Temp1 00\337C OK");lcd.setCursor(0, 1);lcd.print("Temp2 00\337C OK");lcd.setCursor(0 + LCD_OFFSET, 2);lcd.print("Temp3 00\337C OK");lcd.setCursor(0 + LCD_OFFSET, 3);lcd.print("ABGAS 00% OK");return;}int pushS1(int heating) {if (!digitalRead(SWITCH_1)) {while (!digitalRead(SWITCH_1)) delay(100);switch (heating) {case 0:digitalWrite(H_TEMP2, LOW);digitalWrite(H_TEMP3, LOW);digitalWrite(H_TEMP1, HIGH);break;case 1:digitalWrite(H_TEMP1, LOW);digitalWrite(H_TEMP2, HIGH);break;case 2:digitalWrite(H_TEMP2, LOW);digitalWrite(H_TEMP3, HIGH);break;case 3:digitalWrite(H_TEMP1, HIGH);digitalWrite(H_TEMP2, HIGH);digitalWrite(H_TEMP3, HIGH);break;}heating++;return (heating > 3 ? 0 : heating);}return heating;}int pushS2(int heating) {int resetCMF = 0;unsigned long switch_count = 0;if (!digitalRead(SWITCH_2)) {while (!digitalRead(SWITCH_2)) delay(100);switch_count = millis();digitalWrite(H_TEMP1, LOW);digitalWrite(H_TEMP2, LOW);digitalWrite(H_TEMP3, LOW);while (!digitalRead(SWITCH_1)) {delay(100);if (switch_count < millis() - 3000) {memStatus = !memStatus;switch_count = millis();lcd.setCursor(10, 3);lcd.print(memStatus ? '_' : ' ');resetCMF = 0xFF;}}if (resetCMF) {analogWrite(L_TEMP, 0);analogWrite(L_GAS, 0);status = 0;}return 0;}return heating;}int receive_sensor(int opt) {int value = 0x00;value = (opt < 3 ? (int)get_LM75_temperature(opt, 0) : (int)map(analogRead(A0), 35, 870, 0, 100));delay(100);lcd.setCursor(6 + (opt > 1 ? LCD_OFFSET : 0), opt);if (value < 10) lcd.print('0');lcd.print(value);lcd.setCursor(11 + (opt > 1 ? LCD_OFFSET : 0), opt);if (opt < 3 && (value >= oTEMP || value <= uTEMP)) {if (value >= oTEMP && !bitRead(status, opt)) {lcd.print("ALARM");analogWrite(L_TEMP, (memStatus ? 255 : 0));bitWrite(status, opt, 1);if (!bitRead(status, 5)) {toChange = true;bitSet(status, 5);}} else if (value <= uTEMP && bitRead(status, opt)) {lcd.print(" OK");bitWrite(status, opt, 0);if (!(status & 0b00001111)) {toChange = true;if (!bitRead(status, 4)) analogWrite(L_TEMP, 0);bitClear(status, 5);}}} else if (opt == 3) {if (value >= oGAS && !bitRead(status, 4)) {lcd.print("ALARM");bitSet(status, 4);bitClear(status, 3);analogWrite(L_GAS, (memStatus ? 255 : 0)); // PWM Ansteuerung//digitalWrite(L_GAS, (memStatus ? HIGH : LOW));analogWrite(L_TEMP, (memStatus ? 255 : 0));toChange = true;} else if (value >= mGAS && value < oGAS && !bitRead(status, 3)) {analogWrite(L_GAS, (memStatus ? 255 : 0)); // PWM Ansteuerungdelay(1000);analogWrite(L_GAS, (memStatus ? 190 : 0)); // PWM Ansteuerung//digitalWrite(L_GAS, (memStatus ? HIGH : LOW));if (bitRead(status, 4)) {timestamp = (!timestamp ? millis() : timestamp);if (timestamp < millis() - 5000) {if (!(status & 0b00000111))analogWrite(L_TEMP, 0);timestamp = 0;bitClear(status, 4);toChange = true;} elsereturn;}lcd.print(" ");bitSet(status, 3);if (!bitRead(status, 5)) {bitSet(status, 5);toChange = true;}} else if (value <= uGAS && (bitRead(status, 3) || bitClear(status, 4))) {lcd.print(" OK");if (bitRead(status, 4)) {bitClear(status, 4);bitSet(status, 3);}timestampgas = (!timestampgas ? millis() : timestampgas);if (timestampgas < millis() - 5000) {bitClear(status, 3);analogWrite(L_GAS, 0); // PWM Ansteuerung//digitalWrite(L_GAS, LOW);timestampgas = 0;}if (!(status & 0b00000111)) {bitClear(status, 5);analogWrite(L_TEMP, 0);toChange = true;}}}return;}void sendDigitalValue(byte ADDR, byte value) {Wire.beginTransmission(ADDR);Wire.write(value);Wire.endTransmission();}void signalGoGreen(int opt) {int signals = { { 2, 3, 0 }, { 5, 6, 0 }, { 11, 12, 8 }, { 8, 9, 0 }, { 14, 15, 5 } };for (int i = 0; i < 3; i++, delay(500)) {traffic_signal(signals);}return;}void signalGoRed(int opt) {int signals = { { 0, 1, 2 }, { 0, 4, 5 }, { 8, 10, 11 }, { 0, 7, 8 }, { 5, 13, 14 } };for (int i = 0; i < 3; i++, delay(500)) {traffic_signal(signals);}return;}void traffic_signal(int opt) {int lights = 0xFF;counter_switch = pushS1(pushS2(counter_switch));switch (opt) {case 0: lights = 0b11011011; break; // green ledscase 1: lights = 0b11101101; break; // yellew ledscase 2: lights = 0b11110110; break; // red ledscase 3: lights = 0b11100100; break; // red/yellow ledscase 4: lights = 0b11011101; break; // west green / east yellowcase 5: lights = 0b11011110; break; // west green / east redcase 6: lights = 0b11011100; break; // west green / east red/yellowcase 7: lights = 0b11101011; break; // west yellow / east greencase 8: lights = 0b11110011; break; // west red / east greencase 9: lights = 0b11100011; break; // west red/yellow / east greencase 10: lights = 0b11110101; break; // west red / east yellowcase 11: lights = 0b11110110; break; // west red / east redcase 12: lights = 0b11110100; break; // west red / east red/yellowcase 13: lights = 0b11101110; break; // west yellow / east redcase 14: lights = 0b11110110; break; // west red / east redcase 15: lights = 0b11100110; break; // west red/yellow / east reddefault: lights = 0xFF;}sendDigitalValue(TRAFFICLIGHTS, lights);return;}// LM75 read temperature. Device = 0-7, regx = TEMP, OBEN, UNTEN (Select register)double get_LM75_temperature(int device, int regx) {int8_t msb;int8_t lsb;int8_t msb1;Wire.beginTransmission(TEMPADDRESS + device);Wire.write(regx);Wire.endTransmission();Wire.beginTransmission(TEMPADDRESS + device);Wire.requestFrom(TEMPADDRESS + device, 2);if (Wire.available()) {msb1 = Wire.read();msb = msb1 << 1; // Remove sign bit, remaining value is now twice as largelsb = Wire.read();}// The highest bit indicates whether 0.5 degrees are addedlsb = (lsb & 0x80) >> 7;Wire.endTransmission();if (msb1 < 0x80) { // Is the value positive?return double(msb + lsb) / 2; // positive value} else {return double(msb + lsb) / 2 - 128; // negative value}}// LM75 set configurationvoid set_LM75_config(int device, byte value) {Wire.beginTransmission(TEMPADDRESS + device);Wire.write(1); // Select register configWire.write(value);Wire.endTransmission();}// LM75 read configuration, device = 0-7byte get_LM75_config(int device) {byte reg;Wire.beginTransmission(TEMPADDRESS + device);Wire.write(1); // Select register configWire.endTransmission();Wire.requestFrom(TEMPADDRESS + device, 1);if (Wire.available()) {reg = Wire.read();}Wire.endTransmission();return reg;}// LM75 set threshold, device = 0-7, regx = Value, Degree as doublevoid set_LM75_threshold(int device, byte regx, double grad) {int answer = 0;int8_t msb;int8_t lsb = 0;uint8_t y = 0;boolean neg = false;if (grad < 0) {msb = abs(int(grad)) + 128;} else {msb = abs(int(grad));}if (grad - abs(int(grad)) > 0) {lsb = 0x80;}Wire.beginTransmission(TEMPADDRESS + device);Wire.write(regx); // select upper or lower registerWire.write(msb);Wire.write(lsb);answer = Wire.endTransmission();}

author: jwet
author_rank: Frequent Contributor
timestamp: April 30, 2025, 05:32:34 pm
content: It appears to be an Arduino based temperature monitor and fan controller. All voltages are nominally 5v logic level. On the top, there are is I2C controlled I/O expander (8574) that has 6 led's attached that under control of the arduino- you can look through the code and see how they are addressed. At the up right are two 555 based beeper circuits that drive a speaker under control of the arduino. In the center are 3 LM75 I2C temp sensors that measure temps in 3 places. Finally at right is two fans. At the bottom of the circuit is some power and bypassing.I2C is a "inter integrated IC bus" that is like a mini network. The LM75's and PCF8574, hang on it and can each be individually addressed.My guess is that its a safety or control system in a industrial system like a heater or dryer. They took the short cut of using an arduino for the logic and just built this little board with these functions plugged in.The perfboard section is just for future enchancements- this was likely in a low volume product or a prototype and there were still some questions marks.

author: Terry Bites
author_rank: Super Contributor
timestamp: May 03, 2025, 07:00:04 pm
content: thats a very big ask my friend.