Cov txheej txheem:

Bluetooth tus pas ntsuas kub: 8 Kauj Ruam
Bluetooth tus pas ntsuas kub: 8 Kauj Ruam

Video: Bluetooth tus pas ntsuas kub: 8 Kauj Ruam

Video: Bluetooth tus pas ntsuas kub: 8 Kauj Ruam
Video: 10 самых АТМОСФЕРНЫХ мест Дагестана. БОЛЬШОЙ ВЫПУСК #Дагестан #ПутешествиеПоДагестану 2024, Hlis ntuj nqeg
Anonim
Bluetooth tus pas ntsuas kub
Bluetooth tus pas ntsuas kub
Bluetooth tus pas ntsuas kub
Bluetooth tus pas ntsuas kub
Bluetooth tus pas ntsuas kub
Bluetooth tus pas ntsuas kub

Cov lus qhia ntxaws no ua kom yooj yim 2 txoj kev ntsuas cua sov siv 100K ntsuas cua sov, ntsuas Bluetooth thiab lub xov tooj ntawm tes. Bluetooth module yog LightBlue Bean uas tau tsim los ua kom yooj yim Bluetooth Tsawg Zog app kev txhim kho los ntawm kev siv Arduino ib puag ncig paub rau kev teeb tsa tus qauv.

Tom qab dawm ib ncig ib pliag sim txiav txim siab yuav ua li cas thiaj li tau txais cov ntaub ntawv ntsuas kub los ntawm Bluetooth module rau kuv iPhone, Kuv pom ib qho app hu ua EvoThings uas ua kom yooj yim rau kev txhim kho app ntawm txoj haujlwm. Kuv tsis muaj Mac (kuv xav tsis thoob!) Uas txwv kuv lub peev xwm los tsim iPhone app, thiab kuv tsis muaj sijhawm los txiav txim siab Microsoft cov cuab yeej tshiab uas pom tseeb txhawb nqa kev txhim kho hla platform rau iOS thiab Android. Kuv tau ua ntau yam HTML5 style apps tab sis tsuas yog txoj hauv kev kom tau txais ntawm Bluetooth cov ntaub ntawv yog los ntawm plugins rau Cordova uas zoo li muaj teeb meem ntau dua li kuv muaj sijhawm rau. EvoThings muab qhov yooj yim heev rau siv cov cuab yeej uas tig Bluetooth-rau-iPhone kev sib tw rau hauv lub ncuav mog qab zib. Thiab kuv nyiam ncuav mog qab zib!

Zuag qhia tag nrho kuv pom ua ke ntawm Lightblue Bean thiab EvoThings los ua qhov kev daws teeb meem zoo nrog kev nqis peev tsawg.

Kauj Ruam 1: Yam Koj Yuav Tsum Tau

Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau

Kuv siv cov tshuaj ntsuas thermistor uas muaj muag rau ib qho channel vim tias kuv xav tau lub thermistor ntim rau hauv cov dej. Rau cov channel thib ob, Kuv tau tshawb xyuas qhov yooj yim los ntawm lub ntsuas cua sov, qee qhov 26 ntsuas cua xaim thiab 3.5mm lub mloog pob ntseg ntsaws. Koj muaj kev ywj pheej siv cov thermistors uas koj xav tau thiab koj tuaj yeem ua koj tus kheej kev soj ntsuam los ntawm cov khoom siv hluav taws xob epoxy thiab cov yas yas/kas fes tus nplawm piv txwv. Dab tsi hauv qab no yog qhov kuv siv - nws tsis yog lub hom phiaj yuav tsum tau sau cov npe tshuaj!

Kho vajtse

  • 1 x 100K Thermistor probes. Qauv Extech TP890. Cov no feem ntau muaj nyob ntawm ebay thiab amazon.
  • 2 x 2.5mm Lub tso suab tso suab uas phim 2.5mm ntsaws rau ntawm Extech probes. Kuv scavenged 3.5mm jacks los ntawm lub khoos phis tawj qub yog li kuv txiav lub plug tawm ntawm Extech sojntsuam thiab hloov nws nrog 3.5mm plugs. Koj yuav tsum zam qhov no tsuas yog siv 2.5mm jacks, lossis siv lub txee -2.5mm mus rau 3.5mm lub tso suab tso suab ntsaws.
  • 100K thermistor hlaws ntxiv rau 26 gauge hlau ntxiv rau 3.5mm lub tso suab ntsaws yog tias koj xav ua koj tus kheej sojntsuam. Yog tsis yog, yuav qhov kev tshuaj xyuas Extech thib ob!
  • 1 x Lightblue Bean los ntawm Punch Los Ntawm Kev Tsim. Nov yog Bluetooth module programmable ua Arduino pawg thawj coj txhim kho. Module yog tus nqi kim tab sis nws tshem tawm ntau qhov nyuaj. Lawv tab tom khiav Kickstarter phiaj los nqis tes rau lwm tiam ntaus ntawv uas tej zaum yuav tsim nyog xav.
  • 2 x 1/4W 100K resistors uas tau siv los faib qhov ntsuas hluav taws xob rau cov thermistors. Kuv siv 5% resistors tab sis siab dua resistors feem ntau tsis kub rhiab thiab yuav muab kev ua tau zoo dua. 1% yog qhov ua siab ntev rau qhov no.
  • Soldering hlau thiab solder
  • Cov hlau txiav thiab qee qhov ntev me me ntawm 26 lossis 28 ntsuas qhov txuas hlau.

Software thiab Firmware

  • Txhawm rau tsim lub Bean, koj yuav xav tau Bean Loader app. Kuv tau siv windows yog li txhua qhov txuas yuav yog Windows tshwj xeeb. Txhua yam koj xav tau kom pib nrog Bean suav nrog Arduino qhov tshwj xeeb muaj los ntawm LightBlueBean qhov chaw
  • Lub EvoThings workbench rau lub smartphone app muaj nyob ntawm no. Txhua daim ntawv "pib" muaj nyob rau ntawd thiab. Nws yog cov ntaub ntawv zoo heev.

Kauj Ruam 2: Kev Siv Hluav Taws Xob thiab Hluav Taws Xob

Kev Siv Hluav Taws Xob thiab Hluav Taws Xob
Kev Siv Hluav Taws Xob thiab Hluav Taws Xob
Kev Siv Hluav Taws Xob thiab Hluav Taws Xob
Kev Siv Hluav Taws Xob thiab Hluav Taws Xob
Kev Siv Hluav Taws Xob thiab Hluav Taws Xob
Kev Siv Hluav Taws Xob thiab Hluav Taws Xob

Lub thermistor yog qhov ntsuas kub ntawm qhov ntsuas. Kev sojntsuam Extech muaj qhov kub tsis zoo coefficient uas txhais tau tias thaum kub nce, qhov ua haujlwm txo qis. Tus nqi tiv thaiv yog ntsuas nrog cov kab hluav taws xob yooj yim uas tsim qhov sib faib hluav taws xob nrog cov thermistor hauv ib ceg, thiab tsau 100K tus tiv thaiv nyob rau lwm qhov. Qhov sib faib hluav taws xob tau pub rau hauv Analog Input channel ntawm Bean thiab piv txwv hauv cov khoom lag luam.

Txhawm rau tsim lub Circuit Court, Kuv scavenged 3.5mm audio jacks los ntawm lub qub PC tawg. Ib lub ntsuas ntsuas tau siv los txiav txim siab ob lub ntsiab lus ntawm PCB uas sib haum rau qhov taub thiab thawj kab ntawm qhov kev sojntsuam. Cov xov hlau tau txuas rau lub suab thiab lub Bean raws li qhia hauv cov duab. Lub suab kaw tau kaw rau thaj tsam ntawm Bean siv daim kab xev ob tog. Daim kab xev kuv siv yog daim ntawv txiav txim qib qib tsheb uas tsim kom muaj kev sib raug zoo ntawm cov khoom seem.

Kauj Ruam 3: Tshawb Fawb Coefficients

Soj Ntsuam Coefficients
Soj Ntsuam Coefficients

Ib yam li Extech sojntsuam yog, Steinhart-Hart coefficients tsis tau tshaj tawm nyob txhua qhov chaw uas kuv tuaj yeem pom. Hmoov zoo, muaj lub laij lej online uas yuav txiav txim siab qhov sib piv los ntawm 3 qhov ntsuas kub uas koj muab.

Dab tsi foillows yog txheej txheem yooj yim uas kuv tau siv los txog ntawm cov coefficients. Yuav tsis tau txais cov ntsiab lus rau cov style tab sis zoo txaus kom koj hais +/- 1 degree raug (tag nrho cov ntiv tes xoo ntawm kuv ib feem)…. nyob ntawm qhov raug ntawm koj tus pas ntsuas kub siv thiab ntsuas qhov tseeb! Kuv lub ntsuas cua yog qhov pheej yig tsis muaj npe lub npe khoom kuv tau yuav ntau xyoo dhau los thaum cov nyiaj tau nruj. Nyiaj tseem nruj thiab nws tseem ua haujlwm!

Txhawm rau ntsuas, peb xav tau peb qhov kev nyeem tsis kam los ntawm 3 qhov kub thiab txias.

  • Nyob ze khov los ntawm kev ntxiv dej khov rau hauv ib khob dej thiab nplawm kom txog thaum ntsuas kub ruaj khov. Thaum ruaj khov, siv ntau lub ntsuas los ntsuas qhov tsis kam ntawm qhov kev sojntsuam thiab ntsuas tus ntsuas ntsuas kom ntsuas qhov ntsuas kub.
  • Tam sim no tso qhov kev sojntsuam rau hauv ib khob dej ntawm chav sov, tso cai sojntsuam kom sib npaug nrog cov dej kub thiab sau qhov ntsuas kub ntawm koj tus pas ntsuas kub siv thiab ntsuas qhov ntsuas ntawm koj lub 'meter'.
  • Muab qhov kev sojntsuam rau hauv ib khob dej kub thiab sau qhov tsis kam.

    Kub Kuj
    5.6 218k ua
    21.0 97.1k ua
    38.6 43.2

Tag nrho cov txheej txheem no yog me ntsis ntawm qhov nqaij qaib thiab qe vim tias koj xav tau tus ntsuas ntsuas ntsuas kom ntsuas qhov ntsuas kub thiab ntsuas ntau lub ntsuas kom ntsuas qhov tsis kam. Kev ua yuam kev ntawm no yuav ua rau qhov tsis raug hauv qhov ntsuas kub uas koj ua tab sis rau kuv lub hom phiaj, +/- 1 degree ntau dua qhov kuv xav tau.

Plugging cov txiaj ntsig tau teev tseg no rau hauv lub vev xaib lub laij lej ua raws li hauv qab no:

Duab
Duab

Cov coefficents (A, B thiab C) tau txuas rau hauv Stenhart-Hart equation txhawm rau txhawm rau ntsuas qhov ntsuas kub los ntawm qhov piv txwv ua piv txwv. Qhov sib npaug yog txhais raws li (qhov chaw: wikipedia.com)

Duab
Duab

Qhov twg T = Kub hauv Kelvin

A, B thiab C yog Steinhart-Hart equation coefficients peb tab tom txiav txim siab R yog qhov tsis kam ntawm qhov kub T

Lub firmware yuav ua qhov kev suav no.

Kauj ruam 4: Firmware

Firmware
Firmware
Firmware
Firmware

Cov ntsuas hluav taws xob ntsuas hluav taws xob tau piv txwv, hloov pauv mus rau qhov ntsuas kub thiab xa los ntawm Bluetooth mus rau EvoThings app khiav ntawm lub xov tooj ntawm tes.

Txhawm rau hloov qhov hluav taws xob mus rau qhov muaj peev xwm tiv thaiv hauv Bean, ib qho kab zauv yooj yim tau siv. Qhov muab los ntawm qhov sib npaug yog muab ua duab. Hloov chaw ntawm kev hloov pauv tus nqi piv rau qhov hluav taws xob, txij li ob qho tib si ADC thiab cov khoom siv hluav taws xob raug xa mus rau tib lub roj teeb hluav taws xob, peb tuaj yeem siv tus nqi ADC hloov qhov hluav taws xob. Rau 10bit Bean ADC, tag nrho cov roj teeb hluav taws xob yuav ua rau ADC tus nqi ntawm 1023 yog li peb siv tus nqi no ua Vbat. Tus nqi tiag tiag ntawm kev faib cov neeg tawm tsam yog qhov kev txiav txim siab tseem ceeb. Ntsuas tus nqi tiag tiag ntawm 100K tus faib cov neeg tawm tsam thiab siv tus nqi ntsuas hauv qhov sib npaug kom zam qhov tsis tseem ceeb ntawm qhov ua yuam kev vim yog kev tiv taus tiv taus.

Thaum tus nqi tiv thaiv raug suav, qhov ua haujlwm tau hloov pauv mus rau qhov ntsuas kub siv Steinhart-Hart equation. Qhov sib npaug no tau piav qhia ntxaws hauv Wikipedia.

Vim tias peb muaj 2 qhov kev soj ntsuam, nws tau txiav txim siab txhawm rau txhawm rau soj ntsuam kev ua haujlwm rau hauv C ++ chav kawm.

Cov chav kawm suav nrog Steinhart-Hart cov kab zauv sib npaug, qhov sib faib qhov sib npaug tsis sib xws thiab qhov chaw nres nkoj sib piv uas lub thermistor txuas nrog. Ib txoj hauv kev, ntsuas kub (), hloov pauv tus nqi ADC rau tus nqi tsis kam thiab tom qab ntawd siv Steinhart-Hart equation los txiav txim siab qhov kub hauv Kelvin. Tus nqi rov qab rho tawm qhov tsis txaus xoom (273.15K) los ntawm qhov ntsuas kub kom muab tus nqi hauv Celsius.

Lub zog ntawm Lightblue Bean tau pom tseeb hauv qhov tseeb tias txhua qhov kev ua haujlwm Bluetooth yog qhov tseem ceeb tau ua hauv 1 kab ntawm cov cai uas sau cov qauv ntsuas kub mus rau qhov khawb cov ntaub ntawv ntawm thaj chaw Bluetooth nco.

Bean.setScratchData (TEMPERATURE_SCRATCH_IDX, (uint8_t*) & kub [0], 12);

Txhua qhov ntsuas kub piv txwv yog sawv cev los ntawm ntab uas siv 4 bytes. Cov ntaub ntawv khawb thaj tsam tuaj yeem tuav 20 bytes. Peb tsuas yog siv 12 ntawm lawv. Muaj 5 qhov chaw khawb cov ntaub ntawv yog li koj tuaj yeem hloov mus txog 100 bytes ntawm cov ntaub ntawv siv cov ntaub ntawv khawb.

Qhov yooj yim khiav ntawm cov xwm txheej yog:

  • Txheeb xyuas seb peb puas muaj Bluetooth txuas
  • Yog tias yog, ntsuas qhov kub thiab sau lawv mus rau qhov chaw khawb cov ntaub ntawv
  • Pw tsaug zog 200ms thiab rov ua lub voj voog.

Yog tias tsis txuas nrog, lub khoos phis tawj tso lub ATMEGA328P nti tsaug zog ntev. Lub voj voog pw tsaug zog yog qhov tseem ceeb rau kev txuag lub zog. ATMEGA328P nti mus rau hauv lub zog qis thiab nyob ntawd kom txog thaum cuam tshuam los ntawm LBM313 Bluetooth module. LBM313 yuav tsim kom muaj kev cuam tshuam kom sawv ntawm ATMEGA328P thaum kawg ntawm lub sijhawm thov pw tsaug zog, lossis thaum twg los tau ua qhov txuas Bluetooth mus rau Bean. Kev ua haujlwm WakeOnConnect tau qhib los ntawm kev hu ncaj qha rau Bean.enableWakeOnConnect (qhov tseeb) thaum teeb tsa ().

Nws yog ib qho tseem ceeb kom nco ntsoov tias lub khoos phis tawj yuav ua haujlwm nrog ib daim ntawv thov BLE cov neeg siv khoom. Txhua tus neeg siv khoom yuav tsum tau ua yog hle qhov kub bytes los ntawm cov ntaub ntawv khawb hauv txhab nyiaj thiab rov ua dua lawv rau hauv cov lej lej uas ntab rau zaub lossis ua haujlwm. Cov neeg siv khoom yooj yim tshaj plaws rau kuv yog siv EvoThings.

Kauj ruam 5: Smartphone App

Lub Smartphone App
Lub Smartphone App

Cov Evo Yam piv txwv app ze rau qhov kuv xav tau nrog tsuas yog siv zog me me xav tau los ntxiv cov khoom tso tawm kom ua tiav 3 channel ntsuas kub ntsuas.

Kev teeb tsa thiab kev ua haujlwm yooj yim ntawm EvoThings lub platform tau sau tseg zoo heev ntawm Evo Things lub vev xaib yog li tsis muaj nqi hauv kev rov hais dua ntawm no. Txhua yam kuv yuav npog ntawm no yog qhov kev hloov pauv tshwj xeeb uas kuv tau ua rau lawv cov qauv coj los tso saib 3 txoj hauv kev ntawm cov ntaub ntawv ntsuas kub, rho tawm los ntawm Bluetooth kos cov ntaub ntawv.

Tom qab koj tau teeb tsa EvoThings Workbench, koj yuav pom Lightblue Bean piv txwv ntawm no (ntawm Windows 64 ntsis khoos phis tawj):

ThisPC / Cov Ntaub Ntawv / EvothingsStudio_Win64_1. XX / Piv txwv / Lightblue-bean-basic / app

Koj tuaj yeem hloov qhov index.html thiab app.js cov ntaub ntawv nrog cov ntawv txuas nrog rau theem no. Cov kev hloov pauv rau jacascript cov ntaub ntawv rho tawm 3 qhov ntsuas kub qhov kub qhov tseem ceeb tsim qhov khawb cov ntaub ntawv, thiab nce mus rau sab hauv HTML ntawm cov ntsiab lus tshiab tsim hauv HTML ntawv.

muaj nuj nqi onDataReadSuccess (cov ntaub ntawv) {

var temperatureData = tshiab Float32Array (cov ntaub ntawv);

var bytes = tshiab Uint8Array (cov ntaub ntawv);

var kub = temperatureData [0];

console.log ('Kub nyeem:' + kub + 'C');

document.getElementById ('temperatureAmbient'). innerHTML = temperatureData [0].toFixed (2) + "C °";

document.getElementById ('temperature1'). innerHTML = temperatureData [1].toFixed (2) + "C °";

document.getElementById ('temperature2'). innerHTML = temperatureData [2].toFixed (2) + "C °";

}

Kauj Ruam 6: Cov ntaub ntawv kaw

Cov ntaub ntawv kaw
Cov ntaub ntawv kaw
Cov ntaub ntawv kaw
Cov ntaub ntawv kaw
Cov ntaub ntawv kaw
Cov ntaub ntawv kaw
Cov ntaub ntawv kaw
Cov ntaub ntawv kaw

Lub thawv ntawv yog lub npov 3D luam tawm yooj yim. Kuv siv Cubify Tsim los tsim cov qauv tab sis ib qho qauv 3D qauv yuav txaus. Cov ntaub ntawv STL tau txuas rau koj los luam koj tus kheej. Yog tias kuv yuav tsum ua nws dua, Kuv yuav ua kom cov phab ntsa tuab dua li tam sim no, thiab hloov cov qauv tsim uas tuav lub rooj tsavxwm nyob hauv qhov chaw. Cov kab ntawv tawg yooj yim heev vim tias muaj kev nyuab siab nyob hauv lub dav hlau smae raws li 3D luam tawm txheej, uas yog qhov tsis muaj zog tshaj plaws rau 3D luam tawm ntu. Cov phab ntsa yog nyias heev li lub snap mechanism yog me ntsis ntawm sab tsis muaj zog. Kuv tau siv daim kab xev kom kaw lub thawv kaw vim tias cov phab ntsa dhau dhau lawm - tsis zoo nkauj tab sis nws ua haujlwm!

Kauj Ruam 7: PC Chaw thiab Bluetooth Kho

PC teeb tsa thiab teeb tsa Bluetooth
PC teeb tsa thiab teeb tsa Bluetooth

Lub khoos phis tawj tsim thiab xa mus rau Bean tau ua tiav dhau Bluetooth. Tsuas yog tuaj yeem muaj ib qho txuas Bluetooth txuas rau ntawm ib lub sijhawm. Bean Loader muaj nyob ntawm Windows App Store

Lub voj voog yooj yim kuv siv los ua khub thiab txuas (thiab kho thiab rov txuas dua thaum muaj qhov tsis raug) yog raws li hauv qab no: Los ntawm Cov Tswj Vaj Huam Sib Luag;/Bluetooth teeb tsa, koj yuav tsum pom lub vijtsam hauv qab no:

Duab
Duab

Thaum kawg lub qhov rais yuav tshaj tawm "Npaj ua khub". Ntawm qhov no koj tuaj yeem nyem rau ntawm lub cim Bean thiab tom qab qee lub sijhawm, Windows yuav qhia koj kom nkag mus rau tus lej nkag. Lub hauv paus passcode rau taum yog 00000

Duab
Duab

Yog tias tus lej nkag nkag nkag raug, Windows yuav qhia tias lub cuab yeej txuas tau zoo. Koj yuav tsum nyob hauv lub xeev no thiaj li tuaj yeem ua haujlwm rau Bean.

Duab
Duab

Thaum koj tau ua khub thiab txuas nrog, siv Bean Loader txhawm rau thauj lub firmware rau lub taum. Kuv pom qhov no ua tsis tau ntau zaus ntau dua thiab nws zoo li cuam tshuam nrog kev nyob ze rau kuv lub khoos phis tawj. Tsiv Bean ncig kom txog thaum koj pom qhov chaw uas ua haujlwm rau koj. Muaj qee lub sijhawm thaum tsis muaj dab tsi yuav ua haujlwm thiab Bean Loader yuav qhia kom rov ua dua lub cuab yeej. Feem ntau mus dhau cov txheej txheem kev sib txuas dua yuav rov ua kom muaj kev sib txuas. Koj yuav tsum "Tshem Tus Ntaus" ua ntej rov ua dua.

Duab
Duab

Bean Loader kev ua haujlwm yog qhov ncaj thiab tau sau tseg zoo ntawm lawv qhov chaw. Nrog Bean Loader qhib, xaiv "Program" ntawv qhia zaub mov kom qhib qhov kev sib tham los xauj mus rau Hex cov ntaub ntawv muab hauv cov txheej txheem firmware ntawm cov lus qhia no.

Duab
Duab

Thaum lub khoos phis tawj raug rub, Kaw lub Bean Loader kom qhov kev sib txuas ntawm Bean Loader thiab Bean hardware tau poob. Koj tuaj yeem tsuas muaj kev sib txuas ib zaug. Tam sim no qhib EvoThings workbench thiab pib EvoThings tus neeg siv khoom ntawm lub xov tooj smartphone lossis ntsiav tshuaj.

Duab
Duab

Thaum koj nyem lub pob "Khiav", EvoThings tus neeg siv yuav cia li ntsaws nplooj ntawv html rau tus pas ntsuas kub. Nyem rau Txuas Txuas txhawm rau txuas rau Bean thiab koj yuav tsum pom qhov kub tau tshwm sim. Ua tau zoo!

Kauj Ruam 8: Xaus

Xaus
Xaus

Yog tias txhua yam tau tsim thiab teeb tsa kom raug, koj yuav tsum muaj lub kaw lus ua haujlwm uas yuav tso cai rau koj saib xyuas qhov kub thiab txias nrog 2 qhov kev soj ntsuam, nrog rau saib xyuas qhov ntsuas kub ntawm BMA250 sensor ntawm Bean development board. Muaj ntau ntxiv uas tuaj yeem ua tiav nrog EvoThings - Kuv tsuas yog khawb qhov saum npoo yog li kuv tso qhov kev sim no rau koj! Ua tsaug rau kev nyeem ntawv! Yog tias muaj tej yam tsis raug, tsuas yog tawm lus thiab kuv yuav pab qhov twg kuv tuaj yeem ua tau.

Pom zoo: