HS-S06P Four-channel Photoelectric Sensor

HS-S06P Four-channel Photoelectric Sensor

1. Introduction

2. Schematic

Four-channel photoelectric sensor-HS-S06P SchematicClick to view

Module Parameters

Pin Name

description

GND

GND (Negative Power Input)

VCC

VCC (Positive Power Input)

1

Analog Signal Pin

2

Analog Signal Pin

3

Analog Signal Pin

4

Analog Signal Pin

  • Power Supply Voltage: 3.3V / 5V

  • Connection method: PH2.0 terminal wire

  • Installation method: Screw fixed

4, Circuit Board Size

5 of Arduino IDE example program

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Arduino IDE Library Download and Import Tutorial:
Click to view

Example program (UNO development board):

volatile int zoushang;
volatile int youshang;
volatile int zouxia;
volatile int youxia;
void setup(){
 Serial.begin(9600);
 zoushang = 0;
 youshang = 0;
 zouxia = 0;
 youxia = 0;
 pinMode(A0, INPUT);
 pinMode(A1, INPUT);
 pinMode(A2, INPUT);
 pinMode(A3, INPUT);
}
void loop(){
 zouxia = analogRead(A0);
 zoushang = analogRead(A1);
 youxia = analogRead(A2);
 youshang = analogRead(A3);
 delay(500);
 Serial.print("A0๏ผš");
 Serial.print(zouxia);
 Serial.print("******");
 Serial.print("A1๏ผš");
 Serial.print(zoushang);
 Serial.print("******");
 Serial.print("A2๏ผš");
 Serial.print(youxia);
 Serial.print("******");
 Serial.print("A3๏ผš");
 Serial.println(youshang);
}

6, ESP32 Python Example (for Mixly IDE/Misashi)

Choose the development board Python ESP32 [ESP32 Generic(4MB)] and upload in code mode

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

Example program (ESP32-Python):

import machine
import time


adc34 = machine.ADC(machine.Pin(34))
adc35 = machine.ADC(machine.Pin(35))
adc36 = machine.ADC(machine.Pin(36))
adc39 = machine.ADC(machine.Pin(39))
while True:
    print(' A1: ',end ="")
    print(adc34.read_u16(),end ="")
    print(' A2: ',end ="")
    print(adc35.read_u16(),end ="")
    print(' A3: ',end ="")
    print(adc36.read_u16(),end ="")
    print(' A4: ',end ="")
    print(adc39.read_u16())
    time.sleep_ms(200)

7, Mixly example program (graphical language)

Example program (UNO development board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial of Mixly IDE Arduino library:Click to view

Example Program (ESP32 Development Board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

8. Setting up the Test Environment

Arduino UNO Test Environment Setup

Prepare Components:

  • HELLO STEM UNO R3 DEVELOPMENT BOARD *1

  • HELLO STEM UNO R3 P EXPANSION BOARD *1

  • USB TYPE-C DATA CABLE *1

  • Four-channel photoelectric sensor module (HS-S06P) *1

  • PH2.0 6P socket to Dupont wire *1 or PH2.0 6P double-ended socket wire *1

Circuit wiring diagram:

ESP32S3 Test Environment Setup

Prepare Components:Pending update...

Circuit wiring diagram:Pending update...

9, Video tutorial

Video tutorial:Click to view

10, Test results

Arduino UNO test results:

ESP32 Test Results:

Pending update...