Difference between revisions of "8-Bit Level Shift Board SKU: PZSDYZH001"
(→Pin Description) |
(→Case and Test Code) |
||
Line 34: | Line 34: | ||
'''Arduino Code''' | '''Arduino Code''' | ||
− | + | <pre> | |
void setup() { | void setup() { | ||
// put your setup code here, to run once: | // put your setup code here, to run once: | ||
− | for(int i=2;i<10;i++) | + | for(int i=2;i<10;i++){ |
− | { | + | pinMode(i,OUTPUT); |
− | |||
} | } | ||
} | } | ||
Line 45: | Line 44: | ||
void loop() { | void loop() { | ||
// put your main code here, to run repeatedly: | // put your main code here, to run repeatedly: | ||
− | for(int i=2;i<10;i++) | + | for(int i=2;i<10;i++){ |
− | { | + | digitalWrite(i,HIGH); |
− | + | delay(500); | |
− | |||
} | } | ||
delay(1000); | delay(1000); | ||
− | for(int i=10;i>1;i--) | + | for(int i=10;i>1;i--){ |
− | { | + | digitalWrite(i,LOW); |
− | + | delay(500); | |
− | |||
} | } | ||
} | } | ||
− | + | </pre> | |
[[Media: 8-Bit Level Shift Board-Arduino Code Download.rar]] | [[Media: 8-Bit Level Shift Board-Arduino Code Download.rar]] | ||
Line 64: | Line 61: | ||
|[[File:PZSDYZH001-4.jpg |left|600px]] | |[[File:PZSDYZH001-4.jpg |left|600px]] | ||
|} | |} | ||
− | ''' | + | '''Raspberry Pi Code''' |
+ | <pre> | ||
import RPi.GPIO as GPIO | import RPi.GPIO as GPIO | ||
from time import sleep | from time import sleep | ||
Line 129: | Line 127: | ||
GPIO.cleanup() #release all GPIO | GPIO.cleanup() #release all GPIO | ||
+ | </pre> | ||
[[Media: 8-Bit Level Shift Board-Raspberry Pi Code Download.rar]] | [[Media: 8-Bit Level Shift Board-Raspberry Pi Code Download.rar]] | ||
---- | ---- |
Latest revision as of 07:42, 14 January 2022
Description
In daily electronic projects, we may often encounter that the sensor cannot work normally, the project lags behind, and causes certain economic losses. This is caused by the incompatibility of the sensor level with the controller. In order to solve this problem, we have introduced a level conversion module with strong level compatibility and fast signal conversion speed.
This 8-channel level conversion module, the power supply voltage of the A port VA pin. The VA pin can accept a voltage in the range of 1.2V to 3.6V. The B port tracks the supply voltage of the VB pin. The VB pin can accept a voltage in the range of 1.65V to 5.5V. VA must be lower than or equal to VB. These two input power pins can realize any low-voltage bidirectional conversion between 1.2V, 1.8V, 2.5V, 3.3V and 5V voltage nodes. The power supply voltage can be tracked automatically. Its conversion speed can reach up to 60Mbps in push-pull applications, and can be used for level conversion of communication protocols such as I2C, UART, SPI, and OneWire.
Specifications
- VA Voltage Range: 1.2V to 3.6V
- VB Voltage Range: 1.65V to 5.5V
- Conditions of use: VB More Than VA
- Working Current: 30uA
- Support Port: Push-pull, Open drain
- Conversion Speed: Push-pull 60Mbps (MAX) \ Open Drain 2Mbps (MAX)
- Working Temperature Range: -30 Degree Celsius to +75 Degree Celsius
- Product Size: 22mm * 34mm
- Installation Hole Spacing: 15mm
- Fixing Hole Size: 3mm
Pin Description
Case and Test Code
- Materials: Dupont wire, Arduino uno board, level conversion module;
- Use the 2, ~ 3, 4, ~ 5, ~ 6, 7, 8, ~ 9 I/O ports of the Arduino UNO for demonstration as shown below;
- Note: A port voltage is 1.2V ~ 3.6V; B port voltage is 1.65V ~ 5.5V (VA≤VB).
Arduino Connection Method
Arduino Code
void setup() { // put your setup code here, to run once: for(int i=2;i<10;i++){ pinMode(i,OUTPUT); } } void loop() { // put your main code here, to run repeatedly: for(int i=2;i<10;i++){ digitalWrite(i,HIGH); delay(500); } delay(1000); for(int i=10;i>1;i--){ digitalWrite(i,LOW); delay(500); } }
Media: 8-Bit Level Shift Board-Arduino Code Download.rar
Arduino Connection Method
Raspberry Pi Code
import RPi.GPIO as GPIO from time import sleep #LED pin led1 = 18 led2 = 23 led3 = 24 led4 = 25 led5 = 12 led6 = 16 led7 = 20 led8 = 21 GPIO.setmode(GPIO.BCM) # use BCM numbers #set the ledPin OUTPUT mode GPIO.setup(led1,GPIO.OUT) GPIO.setup(led2,GPIO.OUT) GPIO.setup(led3,GPIO.OUT) GPIO.setup(led4,GPIO.OUT) GPIO.setup(led5,GPIO.OUT) GPIO.setup(led6,GPIO.OUT) GPIO.setup(led7,GPIO.OUT) GPIO.setup(led8,GPIO.OUT) while True: #Led lights are lit one by one GPIO.output(led1,GPIO.HIGH) sleep(0.2) # the delay size to control the speed of the water lamp GPIO.output(led2,GPIO.HIGH) sleep(0.2) GPIO.output(led3,GPIO.HIGH) sleep(0.2) GPIO.output(led4,GPIO.HIGH) sleep(0.2) GPIO.output(led5,GPIO.HIGH) sleep(0.2) GPIO.output(led6,GPIO.HIGH) sleep(0.2) GPIO.output(led7,GPIO.HIGH) sleep(0.2) GPIO.output(led8,GPIO.HIGH) sleep(0.2) #Led lights go out one by one GPIO.output(led8,GPIO.LOW) sleep(0.2) GPIO.output(led7,GPIO.LOW) sleep(0.2) GPIO.output(led6,GPIO.LOW) sleep(0.2) GPIO.output(led5,GPIO.LOW) sleep(0.2) GPIO.output(led4,GPIO.LOW) sleep(0.2) GPIO.output(led3,GPIO.LOW) sleep(0.2) GPIO.output(led2,GPIO.LOW) sleep(0.2) GPIO.output(led1,GPIO.LOW) sleep(0.2) GPIO.cleanup() #release all GPIO
Media: 8-Bit Level Shift Board-Raspberry Pi Code Download.rar