Skip to content
TheChatArchiveThe Chat Archive
Hunyuanhunyuan-turbos-20250416· TencentHugging Face LMArena Human Preference 140K

How to wire this setup

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-4.1-2025-04-14’s answer.
  1. User

    How to wire this setup

  2. Hunyuan Assistant

    To wire a setup with 16 QRE1113GR line sensors using a CD74HC4067 multiplexer, you’ll need to understand how to efficiently manage the connections since the QRE1113GR is an analog sensor and the CD74HC4067 supports 16 analog channels. So, you don’t need multiple CD74HC4067 chips—one chip is enough to handle all 16 sensors.


    ✅ Components Summary

    ComponentQuantityNotes
    QRE1113GR Sensors16Analog reflective sensors
    CD74HC4067116-channel analog multiplexer
    Microcontroller1e.g., Arduino Uno, Mega, etc.

    🧰 Wiring Guide

    🔌 Power and Ground

    1. Connect VCC of all QRE1113GR sensors to 5V (or 3.3V if your sensor version supports it).
    2. Connect GND of all QRE1113GR sensors to GND.
    3. Connect VCC and GND of the CD74HC4067 to the same 5V and GND as the microcontroller.
    4. Connect SIG (signal) pin of the CD74HC4067 to an analog input pin on your microcontroller (e.g., A0).

    ⚠️ Important: The QRE1113GR sensors must be powered by the same voltage as the analog reference of your microcontroller (usually 5V).


    📡 Sensor Outputs to MUX Inputs

    Each QRE1113GR sensor has:

    • Collector (C) → connect this to one of the CD74HC4067's analog input channels (X0–X15)
    • Emitter (E) → connect to GND

    So, wire:

    • QRE1113GR #1 Collector → X0
    • QRE1113GR #2 Collector → X1
    • ...
    • QRE1113GR #16 Collector → X15

    ✅ Make sure you don't swap E and C pins — the emitter must go to GND.


    🔄 Multiplexer Control Pins

    Connect the select pins of the CD74HC4067 to digital pins on your microcontroller:

    CD74HC4067 PinFunctionArduino Pin Example
    S0Channel bit 0D2
    S1Channel bit 1D3
    S2Channel bit 2D4
    S3Channel bit 3D5
    EN (Enable)Active LOWD6 (optional) – tie to GND if not needed

    🔹 If you tie EN (Enable) pin to GND, the chip is always enabled. Otherwise, connect it to a digital pin and set it to LOW to enable.


    🖥️ Final Connections Overview

    Sensor/QRE1113GRCD74HC4067Arduino
    Collector (C)X0–X15—
    Emitter (E)GND—
    VCCVCC5V
    GNDGNDGND
    SIG (MUX out)A0A0
    S0–S3D2–D5D2–D5
    EN (optional)GNDGND

    🧪 Arduino Code Example

    const int s0 = 2;
    const int s1 = 3;
    const int s2 = 4;
    const int s3 = 5;
    const int sigPin = A0;
    
    void setup() {
      pinMode(s0, OUTPUT);
      pinMode(s1, OUTPUT);
      pinMode(s2, OUTPUT);
      pinMode(s3, OUTPUT);
      digitalWrite(s0, LOW);
      digitalWrite(s1, LOW);
      digitalWrite(s2, LOW);
      digitalWrite(s3, LOW);
    
      Serial.begin(9600);
    }
    
    // Channel selection: 0 to 15
    int readSensor(int channel) {
      digitalWrite(s0, bitRead(channel, 0));
      digitalWrite(s1, bitRead(channel, 1));
      digitalWrite(s2, bitRead(channel, 2));
      digitalWrite(s3, bitRead(channel, 3));
    
      return analogRead(sigPin);
    }
    
    void loop() {
      for (int i = 0; i < 16; i++) {
        int val = readSensor(i);
        Serial.print("Channel ");
        Serial.print(i);
        Serial.print(": ");
        Serial.println(val);
        delay(100); // Delay between readings
      }
    }
    

    🛠️ Tips

    • Use pull-down resistors (e.g., 10kΩ) on the sensor output if needed, though the QRE1113GR generally doesn’t require them when connected directly to the MUX.
    • If your sensors are not detecting properly, ensure they’re receiving enough light and are positioned correctly over a contrasting surface.
    • For better accuracy, shield the sensors from ambient IR light or use optical filters.

    ✅ Summary

    With one CD74HC4067, you can easily read 16 analog QRE1113GR sensors using just 5 digital control pins + 1 analog input on your microcontroller. This saves a lot of I/O pins and makes your wiring cleaner and more scalable.

    If you need help with PCB layout, sensor calibration, or integrating this into a robot (like a line follower), feel free to ask!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.