Cov txheej txheem:

Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam: 4 Kauj Ruam
Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam: 4 Kauj Ruam

Video: Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam: 4 Kauj Ruam

Video: Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam: 4 Kauj Ruam
Video: How To Interface ADXL335 Analog Accelerometer Sensor With Arduino 2024, Hlis ntuj nqeg
Anonim
Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam
Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam
Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam
Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam
Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam
Interface ADXL335 Sensor ntawm Raspberry Pi 4B hauv 4 Kauj Ruam

Hauv Cov Lus Qhia no peb yuav cuam tshuam nrog ADXL335 (ntsuas lub ntsuas) ntsuas ntawm Raspberry Pi 4 nrog Shunya O/S

Khoom siv

  1. Raspberry Pi 4B (txhua yam sib txawv)
  2. Raspberry Pi 4B ua raws lub zog siv
  3. 8GB lossis loj dua daim npav micro SD
  4. Saib xyuas
  5. micro-HDMI Cable
  6. Nas
  7. Keyboard
  8. laptop lossis lwm lub khoos phis tawj los teeb tsa daim npav nco
  9. ADXL3355 Accelerometer sensor - Yuav
  10. PCF8591 ADC module - Yuav
  11. Cov qhob cij
  12. Txuas xov hlau

Kauj Ruam 1: Nruab Shunya OS ntawm Raspberry Pi 4

Koj yuav xav tau lub khoos phis tawj lossis khoos phis tawj nrog lub micro SD daim npav nyeem ntawv/hloov pauv kom thauj daim npav micro SD nrog Shunya OS.

  1. Rub tawm Shunya OS los ntawm kev tso tawm e site
  2. Shunya OS cov menyuam muaj kev qhia zoo ntawm Flashing Shunya OS ntawm Raspberry Pi 4.
  3. Ntxig daim npav micro SD rau hauv Raspberry Pi 4.
  4. Txuas tus nas & keyboard rau Raspberry Pi 4.
  5. Txuas Saib Xyuas rau Raspberry Pi 4 ntawm micro-HDMI
  6. Txuas lub xov tooj hluav taws xob thiab Lub Hwj Chim ntawm Raspberry Pi 4.

Raspberry Pi 4 yuav tsum khau raj nrog Shunya OS.

Kauj ruam 2: Nruab Shunya Interfaces

Shunya Interfaces yog GPIO lub tsev qiv ntawv rau txhua lub rooj txhawb nqa los ntawm Shunya OS.

Txhawm rau teeb tsa Shunya Interfaces peb yuav tsum txuas nws mus rau wifi nrog siv internet.

1. Txuas rau wifi siv qhov hais kom ua

$ nmtui

2. Txhim kho Shunya Interfaces yog ib qho yooj yim, tsuas yog khiav cov lus txib

$ sudo apt nruab shunya-cuam tshuam

Kauj Ruam 3: Kev Sib Txuas Sensor

Kev Sib Txuas Sensor
Kev Sib Txuas Sensor

ADXL335 yog qhov ntsuas sib piv, tab sis Raspberry Pi 4 yog cov cuab yeej siv digital. Yog li peb xav tau tus hloov pauv PCF8591 (ADC) uas hloov pauv txhua qhov txiaj ntsig zoo sib xws muab los ntawm ADXL335 rau cov txiaj ntsig digital nkag siab los ntawm Raspberry Pi 4.

Daim duab kab hluav taws xob tau muab rau hauv daim duab saum toj no.

  1. Txuas SDA & SCL pins ntawm PCF8591 rau tus pin 3 & tus pin 5 ntawm Raspberry Pi 4.
  2. Txuas VCC & GND ntawm PCF8591 rau tus pin 4 (5V) & tus pin 6 (GND) ntawm Raspberry Pi 4.
  3. Txuas VCC & GND ntawm ADXL335 rau VCC & GND ntawm PCF8591.
  4. Txuas Ain1 ntawm PCF8591 rau X ntawm ADXL335.
  5. Txuas Ain2 ntawm PCF8591 rau Y ntawm ADXL335.
  6. Txuas Ain3 ntawm PCF8591 rau Z ntawm ADXL335.

Kauj Ruam 4: Piv Cai

Piv txwv li Code
Piv txwv li Code
  • Rub cov cai hauv qab no.
  • Sau nws siv qhov hais kom ua

$ gcc -o adxl335 adxl335.c -lshunyaInterfaces

Khiav nws siv qhov hais kom ua

$ sudo./adxl335

Pom zoo: