Cov txheej txheem:
- Kauj Ruam 1: Yuav Tsum Kho Vajtse:
- Kauj ruam 2: Khoos phis tawj sib txuas:
- Kauj Ruam 3: Arduino Code rau Kev Ntsuas Kev Ntsuas:
- Kauj Ruam 4: Cov ntawv thov:
Video: Kev Ntsuas Kev Ntsuas Siv BMA250 thiab Arduino Nano: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
BMA250 yog qhov me me, nyias, lub zog loj, 3-axis accelerometer nrog kev ntsuas siab (13-ntsis) ntsuas txog li g 16 g. Cov ntaub ntawv tso tawm digital yog ua raws li 16-ntsis twos ua tiav thiab siv tau los ntawm I2C digital interface. Nws ntsuas qhov kev nrawm nrawm ntawm lub ntiajteb txawj nqus hauv kev thov qaij-nkag siab, nrog rau kev nrawm nrawm los ntawm kev txav lossis poob siab. Nws qhov kev daws teeb meem siab (3.9 mg/LSB) ua rau ntsuas ntsuas qhov xav tau hloov qis dua 1.0 °.
Hauv qhov kev qhia no peb yuav ntsuas qhov nrawm hauv txhua peb txoj kab uas hla uas siv BMA250 thiab Arduino Nano.
Kauj Ruam 1: Yuav Tsum Kho Vajtse:
Cov ntaub ntawv uas peb xav tau kom ua tiav peb lub hom phiaj suav nrog cov khoom siv hauv qab no:
1. BMA250
2. Arduino Nano
3. I2C Cable
4. I2C Shield Rau Arduino Nano
Kauj ruam 2: Khoos phis tawj sib txuas:
Tshooj khoos phis tawj sib txuas ntu piav qhia qhov txuas txuas uas xav tau ntawm lub sensor thiab arduino. Ua kom muaj kev sib txuas raug yog qhov tseem ceeb xav tau thaum ua haujlwm ntawm ib qho system rau qhov xav tau cov zis. Yog li, qhov xav tau kev sib txuas yog raws li hauv qab no:
BMA250 yuav ua haujlwm dhau I2C. Nov yog qhov piv txwv kab hluav taws xob daim duab, qhia txog yuav ua li cas xaim txhua lub interface ntawm lub sensor.
Tawm-ntawm-lub thawv, lub rooj tsavxwm tau teeb tsa rau I2C interface, zoo li peb pom zoo siv qhov kev sib txuas no yog tias koj tsis ntseeg lwm yam. Txhua yam koj xav tau yog plaub lub xov hlau!
Tsuas yog plaub qhov kev sib txuas xav tau Vcc, Gnd, SCL thiab SDA tus pin thiab cov no txuas nrog kev pab ntawm I2C cable.
Cov kev sib txuas no tau qhia hauv cov duab saum toj no.
Kauj Ruam 3: Arduino Code rau Kev Ntsuas Kev Ntsuas:
Cia peb pib nrog Arduino code tam sim no.
Thaum siv lub ntsuas ntsuas nrog Arduino, peb suav nrog Wire.h lub tsev qiv ntawv. "Hlau" lub tsev qiv ntawv muaj cov haujlwm uas pab txhawb i2c kev sib txuas lus ntawm lub sensor thiab Arduino board.
Tag nrho cov cai Arduino tau muab hauv qab no kom yooj yim ntawm cov neeg siv:
#suav nrog
// BMA250 I2C chaw nyob yog 0x18 (24)
#define Ntxiv 0x18
void teeb tsa ()
{
// Pib I2C kev sib txuas lus li MASTER
Hlau.begin ();
// Initialise Serial Communication, teeb baud tus nqi = 9600
Serial.begin (9600);
// Pib I2C Kev Kis
Wire.beginTransmission (Addr);
// Xaiv thaj tsam xaiv sau npe
Hlau.write (0x0F);
// Teeb tsa ntau yam +/- 2g
Hlau.write (0x03);
// Nres I2C Kev Kis
Wire.endTransmission ();
// Pib I2C Kev Kis
Wire.beginTransmission (Addr);
// Xaiv bandwidth rau npe
Hlau.write (0x10);
// Teeb bandwidth 7.81 Hz
Hlau.write (0x08);
// Nres I2C Kev Kis
Wire.endTransmission (); ncua (300);}
void lub voj ()
{
unsigned int cov ntaub ntawv [0];
// Pib I2C Kev Kis
Wire.beginTransmission (Addr);
// Xaiv Cov Ntaub Ntawv Sau Npe (0x02 - 0x07)
Hlau.write (0x02);
// Nres I2C Kev Kis
Wire.endTransmission ();
// Thov 6 bytes
Wire.requestFrom (Addr, 6);
// Nyeem rau rau bytes
// xAccl lsb, xAccl msb, yAccl lsb, yAccl msb, zAccl lsb, zAccl msb
yog (Wire.available () == 6)
{
cov ntaub ntawv [0] = Wire.read ();
cov ntaub ntawv [1] = Wire.read ();
cov ntaub ntawv [2] = Wire.read ();
cov ntaub ntawv [3] = Wire.read ();
cov ntaub ntawv [4] = Wire.read ();
cov ntaub ntawv [5] = Wire.read ();
}
ncua (300);
// Hloov cov ntaub ntawv mus rau 10 khoom
ntab xAccl = ((data [1] * 256.0) + (data [0] & 0xC0)) / 64;
yog (xAccl> 511)
{
xAccl -= 1024;
}
ntab yAccl = ((data [3] * 256.0) + (data [2] & 0xC0)) / 64;
yog (yAccl> 511)
{
yAccl -= 1024;
}
ntab zAccl = ((data [5] * 256.0) + (data [4] & 0xC0)) / 64;
yog (zAccl> 511)
{
zAccl -= 1024;
}
// Tso tawm cov ntaub ntawv rau tus saib xyuas
Serial.print ("Ua kom nrawm hauv X-Axis:");
Serial.println (xAccl);
Serial.print ("Kev nrawm hauv Y-Axis:");
Serial.println (yAccl);
Serial.print ("Ua kom nrawm hauv Z-Axis:");
Serial.println (zAccl);
}
Hauv cov tsev qiv ntawv xaim Wire.write () thiab Wire.read () yog siv los sau cov lus txib thiab nyeem cov ntawv tso tawm. Serial.print () thiab Serial.println () yog siv los tso saib cov pa tawm ntawm cov saib xyuas ntawm Arduino IDE.
Cov zis sensor tau pom hauv daim duab saum toj no.
Kauj Ruam 4: Cov ntawv thov:
Accelerometers zoo li BMA250 feem ntau pom nws daim ntawv thov hauv kev ua si thiab tso saib cov ntaub ntawv hloov pauv. Qhov ntsuas qhov ntsuas no tseem ua haujlwm hauv kev tswj hwm lub zog zoo rau kev siv mobile. BMA250 yog lub triaxial digital acceleration sensor uas tau koom nrog nrog kev txawj ntse ntawm-nti cov lus tsa suab cuam tshuam kev tswj hwm.
Pom zoo:
Kev Ntsuas thiab Kev Ntsuas Kub Siv HIH6130 thiab Arduino Nano: 4 Cov Kauj Ruam
Kev Ntsuas thiab Kev Ntsuas Kub Siv HIH6130 thiab Arduino Nano: HIH6130 yog qhov ntsuas cua thiab ntsuas kub nrog cov zis digital. Cov ntsuas no muab qib raug ntawm ± 4% RH. Nrog kev lag luam-ua kom muaj kev ruaj ntseg mus sij hawm ntev, qhov tseeb kub-them nyiaj digital I2C, Kev lag luam ua rau muaj kev ntseeg siab, Kev siv hluav taws xob
Kev Ntsuas thiab Kev Ntsuas Kub Siv HTS221 thiab Arduino Nano: 4 Cov Kauj Ruam
Kev Ntsuas thiab Kev Ntsuas Kub Siv HTS221 thiab Arduino Nano: HTS221 yog lub ntsuas hluav taws xob me me uas muaj peev xwm ntsuas tau rau qhov txheeb ze thiab qhov kub thiab txias. Nws suav nrog lub hauv paus ntsiab lus thiab cov teeb liab sib xyaw daim ntawv thov tshwj xeeb kev sib txuas (ASIC) los muab cov ntaub ntawv ntsuas los ntawm cov lej
Kev Ntsuas Kev Ntsuas Siv BMA250 thiab Raspberry Pi: 4 Kauj Ruam
Kev Ntsuas Kev Ntsuas Siv BMA250 thiab Raspberry Pi: BMA250 yog qhov me me, nyias, lub zog qis, 3-axis accelerometer nrog kev daws teeb meem siab (13-ntsis) ntsuas txog ± 16 g. Cov ntaub ntawv tso tawm digital yog ua raws li 16-ntsis twos ua tiav thiab siv tau los ntawm I2C digital interface. Nws ntsuas qhov zoo li qub
Kev Ntsuas Kev Ntsuas Siv BMA250 thiab Particle Photon: 4 Kauj Ruam
Kev Ntsuas Kev Ntsuas Siv BMA250 thiab Particle Photon: BMA250 yog qhov me me, nyias, lub zog loj, 3-axis accelerometer nrog kev daws teeb meem siab (13-ntsis) ntsuas txog ± 16 g. Cov ntaub ntawv tso tawm digital yog ua raws li 16-ntsis twos ua tiav thiab siv tau los ntawm I2C digital interface. Nws ntsuas qhov zoo li qub
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej