Cov txheej txheem:

Hug-Time Bracelet: 6 Kauj Ruam
Hug-Time Bracelet: 6 Kauj Ruam

Video: Hug-Time Bracelet: 6 Kauj Ruam

Video: Hug-Time Bracelet: 6 Kauj Ruam
Video: Mob Txaus Lawm - Txhaij Lauj Ft. Tijlaug Xab Thoj (Special Project) 2024, Kaum ib hlis
Anonim
Hug-Sijhawm Hlua Tes
Hug-Sijhawm Hlua Tes

Kuv xav ua kom kuv tus ntxhais ib txoj hlua tes uas nws tuaj yeem hnav uas yuav qhia nws thaum nws yog Hug-Time yog li nws tuaj yeem ua txuj ua ib tus cim los ntawm Trolls. Rau cov ntawm koj uas tsis paub, cov trolls siv tag nrho lawv lub sijhawm hu nkauj thiab seev cev, tab sis ib teev ib zaug lawv muaj sijhawm puag. Txhua tus trolls tau sib sau ua ke nrog lub paj paj paj uas ci thaum nws txog sijhawm puag.

Qhov no zoo li yog txoj haujlwm nrawm zoo nkauj uas suav nrog cov tshuab, hluav taws xob, thiab software tsim. Qhov chaw tau yooj yim pom ntawm Adafruit. Lawv muaj kab ntawm cov khoom siv me me raws li ATiny85 uas tau tsim los ua ke rau hauv kev hnav, Gemma yog qhov tsawg tshaj plaws.

M0 version ntawm cov khoom siv tuaj yeem ua haujlwm nrog CircuitPython. Adafruit muab qee qhov piv txwv piv txwv uas yog qhov kuv xav tau kom tau txais txoj haujlwm ua haujlwm.

Kauj Ruam 1: Cov Npe thiab Cov Npe

Qhov Chaw thiab Cov Npe Tshwj Xeeb
Qhov Chaw thiab Cov Npe Tshwj Xeeb

Qhov

Adafruit Gemma M0

Adafruit MicroLipo Charger

Adafruit 150mAh Lipo Roj teeb

Pob ntawm Velcro cable ties

Cov ntawv luam tawm 3D thiab paj saum, cov ntaub ntawv ntawm Thingiverse

Nta

  • Qhov taw qhia puag yog RGB LED ntawm lub Rooj Tswjhwm Saib Gemma
  • Programmable Hug qhov taw qhia tig rau lub sijhawm
  • Hug qhia qeeb ramp tig rau
  • Capacitive kov pib dua
  • Tshem lub hau paj kom nkag mus rau qhov qhib/tawm hloov
  • On-board USB charger
  • Tsis tas yuav tshem cov khoom siv hluav taws xob los them, USB txuas los ntawm rooj plaub

Kauj Ruam 2: Npaj thiab xaim hluav taws xob

Npaj thiab xaim hluav taws xob
Npaj thiab xaim hluav taws xob
Npaj thiab xaim hluav taws xob
Npaj thiab xaim hluav taws xob
Npaj thiab xaim hluav taws xob
Npaj thiab xaim hluav taws xob
Npaj thiab xaim hluav taws xob
Npaj thiab xaim hluav taws xob

Lub Rooj Tswjhwm Saib Gemma zoo tshaj plaws rau txoj haujlwm no, tabsis kom khaws txoj hlua tes kom txaus rau 3 xyoos tus dab teg, kuv yuav tsum xaiv lub roj teeb me me. Lub roj teeb 150mAh tsuas yog qhov loj me tab sis yuav tsum tau them txhua hnub. Cov menyuam hnub nyoog 3 xyoos tsis tuaj yeem muab lub kaus mom rov qab rau ntawm cov cim yog li peb tsis tuaj yeem cia siab tias lawv yuav kaw cov khoom siv hluav taws xob thaum tsis siv.

Qhov kev lees paub no yuam kom xav tau kev them nyiaj hauv lub nkoj.

Saib ntawm Gemma schematic thiab lub tshuab hluav taws xob kuv tuaj yeem pom yuav ua li cas txuas ob qho no ua ke. Saib cov schematic snips.

Npaj Lub Rooj Tsav Xwm

Txhawm rau ua kom lub charger them nyiaj haum rau hauv rooj plaub koj yuav tsum xub tshem lub micro-USB nkaus thiab lub roj teeb txuas. Ua tib zoo nqa rab phom cua sov thiab ua kom sov lub rooj tsavxwm. Tsis txhob tawg ntawm nws lossis koj tuaj yeem desolder cov passives. Koj tsuas yog xav kom muaj cua sov txaus kom tau lub tshuab ziab khaub ncaws ntawm USB nkaus thiab lub roj teeb txuas lub pawm loj kom luag yuav yaj. Tom qab ntawd nqa cov hlau txuas sai thiab txav los ntawm lub ncoo mus rau ncoo yaj cov laug thaum txhuam cov txuas nrog cov pliers me me.

Rub lub jack mounting pawm tawm ntawm lub rooj tsavxwm yog qhov ua tau zoo vim tias koj yuav siv lub thru-qhov ntsuas qhov ntsuas vias muab rau ntawm lub rooj tsavxwm.

Hlau Cov Ntsiab Lus Ua Ke

Lub rooj tsav tsheb them nyiaj tau yooj yim me ntsis hla lub qhov vias uas ua rau thaiv tau yooj yim. Siv ob txoj hlua sib txuas ntawm cov xaim luv thiab muab lawv tso rau raws li qhia.

Charger 5V ---- Gemma Anode D2

Charger BAT --- Gemma Anode D1

Charger GND los --- Gemma board ntug GND ncoo

Kev xa xov hlau tau qhia hauv cov duab

Tiv thaiv lub Rooj Tswjhwm Saib Charger

Siv qee daim kab xev uas tsis yog tus coj, Kuv siv Kapton, txhawm rau tiv thaiv cov khoom siv hluav taws xob los ntawm qhov ua kom luv. Qhov no tsuas yog kev ceev faj.

Kauj Ruam 3: Txuas thiab Kuaj Lub Roj Teeb

Txuas thiab Kuaj Cov Roj Teeb
Txuas thiab Kuaj Cov Roj Teeb

Lub roj teeb muaj peev xwm 150mAh. Cov ntaub ntawv rau Gemma muaj kev siv tam sim no ntawm 9mA. Yog li ntawd kwv yees txhais tau tias yog tias Gemma nyob, lub roj teeb yuav ntws tawm hauv 16.7 teev

9 * t = 150 - t = 150/9 = 16.7

Cov ntaub ntawv rau lub charger hais tias nws los ua ntej teeb tsa nrog tus nqi 100mA. Lub roj teeb uas puv dej yuav them hauv 1.5 teev (150mA/100mA = 1.5)

Txuas lub roj teeb rau Gemma lub taub hau roj teeb. Lub roj teeb los nrog tus phooj ywg mus rau qhov txuas yog li kev sib txuas yog yooj yim heev, tsuas yog ntsaws rau hauv. Tom qab ntawd txuas lub micro-USB cable rau Gemma lub USB nkaus thiab lwm qhov kawg ntawm kab lus rau USB phab ntsa them nyiaj lossis USB chaw nres nkoj ntawm lub computer. Lub charger liab LED yuav nyob, qhia tias lub roj teeb tau them. Muaj ib lub ntsuab ntsuab uas yuav qhia tias them nqi tiav.

Tiv thaiv Roj Teeb

Lub roj teeb zoo li tau qhwv hauv mylar. Kuv siv tib daim kab xev Kapton los tiv thaiv lub roj teeb.

Quirk… nyeem ntxiv

Ib yam uas yuav tsum nco ntsoov yog thaum VBUS TSIS txuas nrog, lub teeb liab liab LED ntawm MicroLipo board yuav me ntsis. Qhov no yog vim muaj qhov thim rov qab ntawm qhov thaiv diodes ntawm Gemma. Ib qho me me tam sim no yuav ntws los ntawm cathode mus rau anode ntawm VBUS diode los ntawm roj teeb. Qhov me me tam sim no ntws los ntawm lub charger lub liab LED txaus kom tig nws me ntsis. Yuav tsis muaj kev puas tsuaj rau lub nti them rau hauv hom no.

Standby kos tam sim no yog tsawg. Kuv tau xaws tes qhwv rau ib lub lim tiam thiab nws tseem muaj nqi txaus los khiav. Yog li kuv zoo nrog qhov kos me me no.

Kauj Ruam 4: Program Gemma Nrog CircuitPython

Kuv siv CircuitPython los ua haujlwm Gemmo. Ib qho kev qhia tuaj yeem pom ntawm no.

Ua ntej kuv hloov qhov piv txwv main.py cov ntaub ntawv uas los ntawm Gemma los ntawm lub neej ntawd. Tus piv txwv tus lej ntiav tus neeg siv lub ntsej muag kov lub ntsej muag thiab tus tsav tsheb RGB LED.

Hauv qab no yog cov cai:

# Hugtime Hlua tes# mcencinitas

los ntawm adafruit_hid.keyboard ntshuam Keyboard

los ntawm adafruit_hid.keycode ntshuam Keycode los ntawm digitalio ntshuam DigitalInOut, Qhia, Rub los ntawm analogio ntshuam AnalogIn, AnalogOut los ntawm touchio ntshuam TouchIn ntshuam adafruit_dotstar li dotstar ntshuam microcontroller ntshuam pawg tswj hwm ntshuam sijhawm

# Ib lub pixel txuas nrog sab hauv!

dot = dotstar. DotStar (board. APA102_SCK, board. APA102_MOSI, 1, ci ntsa iab = 0.1) dot [0] = 0x000000 #Init rau OFF

#Kov kov ntawm A2

touch2 = TouchIn (boardA2)

################### constants ############################## #####

HUGLITE = 0x0040ff

#HUGTIME = 60 * 60 #Ib Teev (60s * 60min) HUGTIME = 60 * 2 #Debug, 2min

##################################################################################### ######

#Fade dot hauv thiab tawm

def fade (pixel): kuv = 0.2 thaum kuv <= 1: pixel.brightness = kuv time.sleep (0.075) kuv+= 0.1 print (kuv) rov qab

######################### MAIN LOOP ############################# #######

time_zero = sij hawm.monotonic ()

thaum muaj tseeb: cur_time = time.monotonic () - time_zero yog (cur_time> HUGTIME): #Loop kom txog thaum HUGTIME tau mus txog dot [0] = HUGLITE #Teeb LED rau cov xim uas xav tau.) #Fade hauv LED thaum kov2.value == 0: tos = 1 #Hlub qhov no kom txog thaum lub ntsuas tau kov

dot [0] = 0x000000 #Tua tawm LED tom qab rov pib dua

dot.brightness = 0.1 #Reset qhov ci dua li lub sijhawm tom ntej LED tig rau nws tuaj yeem ploj mus lub sijhawm _ xoom = sijhawm.monotonic () #Reset xoom lub sijhawm #print (cur_time)

CircuitPython yog qhov ntse heev uas koj hloov cov ntawv no hauv koj tus kws kho mob nyiam (Tsis ua haujlwm, sau ntawv, Mu, thiab lwm yam …), npe nws "main.py", thiab tsuas yog luam nws mus rau Gemma. Gemma qhia tau zoo li lub zog tsav, koj tsuas yog tso koj lub main.py ntawm tus tsav. Gemma reboots txiav thiab sau cov cai… Yooj yim!

Kauj Ruam 5: Luam Cov Case thiab Sib Sau

Luam Case thiab Sib Sau
Luam Case thiab Sib Sau
Luam Case thiab Sib Sau
Luam Case thiab Sib Sau
Luam Case thiab Sib Sau
Luam Case thiab Sib Sau

Case

Rub tawm cov ntawv.stl los ntawm Thingiverse

Kev teeb tsa lub tshuab luam ntawv 3D nyob ntawm Nplooj Ntawv. Kuv siv ABS, koj tuaj yeem siv txhua yam uas koj nyiam nrog.

Cov ntaub ntawv tag nrho yog ob ntu

  1. Paj saum
  2. Cov ntaub ntawv hluav taws xob

Los ua ke

Cov ntaub ntawv muaj qhov qhib rau hauv qab kom pub Velcro cable khi hla los ua lub dab teg. Pub cov qhab los ntawm qhov qhib ua ntej tso cov khoom siv hluav taws xob rau hauv rooj plaub.

Tom ntej no koj xav ua cov khoom siv hluav taws xob qhaub cij. Kuv pom tias yog tias koj muaj lub Rooj Tswjhwm Saib Gemma nyob rau sab saum toj, koj tuaj yeem haum lub roj teeb nyob hauv nruab nrab thiab lub charger nyob hauv qab hauv cov pawg zoo. Cov roj teeb xaim yog ntev dua. Tej zaum nws tuaj yeem raug txiav tawm, Kuv tsuas yog tsis xav nrog nws. Nws qhwv ib ncig rau saum.

Tom qab koj muaj koj lub qhaub cij, ntsaws nws rau hauv rooj plaub siv lub qhov rau USB chaw nres nkoj raws li kev qhia. Txuas lub USB cable rau hauv lub Rooj Tswjhwm Saib Gemma los ntawm rooj plaub, tab sis tsis txhob txuas lwm qhov kawg ntawm txoj hlua. Qhov no yuav tuav lub rooj tsavxwm nyob hauv qhov chaw zoo li koj pom qhov chaw zoo txhawm rau txhawm rau lub qhov me me rau lub peev xwm rov pib dua "khawm"

Kuv siv luv tab sis tuab ntawm cov hlau raws li kuv rov pib dua "khawm". Cov xaim tau nqa los ntawm ib kab hauv kab ntawv, tab sis koj tuaj yeem siv txhua hom xaim. Xam tawm qhov chaw zoo tshaj plaws los tso lub qhov rau ntawm koj rooj plaub, kos nws, tom qab ntawd laum.

Tawm cov xaim ntev tshaj qhov ntev kawg. Koj yuav xav txiav mus rau sab ntawm rooj plaub nrog cov khoom siv hluav taws xob tag nrho hauv lawv qhov chaw zaum kawg.

Siv cov khoom siv hluav taws xob tawm, tshem lub roj teeb, thiab txuas cov xaim rau Gemma's A2 ncoo.

Muab cov khoom siv hluav taws xob rov qab rau hauv rooj plaub nrog cov xaim hluav taws xob nkag los ntawm lub qhov thiab USB jack nyob hauv qhov chaw. Nyem qhov pib dua "khawm" yuav luag yaug nrog rooj plaub.

Kauj Ruam 6: Xeem

Kuaj
Kuaj
Kuaj
Kuaj

Qhib Gemma thiab tos kom LED qhib.

Qhib rau yog ib qho kev nce toj, yog li nws maj mam ci dua.

Txais koj puag

Kov lub "khawm" kom rov pib lub sijhawm

Pom zoo: