{"id":31,"date":"2018-10-05T15:45:01","date_gmt":"2018-10-05T15:45:01","guid":{"rendered":"http:\/\/uni.hi.is\/martin\/?p=31"},"modified":"2021-08-31T15:05:53","modified_gmt":"2021-08-31T15:05:53","slug":"hitastigsmaelingar","status":"publish","type":"post","link":"https:\/\/uni.hi.is\/martin\/2018\/10\/05\/hitastigsmaelingar\/","title":{"rendered":"Hitastigsm\u00e6lingar"},"content":{"rendered":"<p>\u00c9g f\u00f3r af sta\u00f0 me\u00f0 hitstigsm\u00e6lingar me\u00f0 Raspberry Pi fyrir um tveimur \u00e1rum en okkur Sn\u00e6bj\u00f6rn Gu\u00f0mundsson langa\u00f0i til a\u00f0 b\u00faa til frost\u00fe\u00fd\u00f0uklefa sem m\u00e9r datt \u00ed hug a\u00f0 keyra me\u00f0 Raspberry Pi t\u00f6lvu.<\/p>\n<p>Svo datt \u00fea\u00f0 eitthva\u00f0 uppfyrir og \u00e9g n\u00e1\u00f0i aldrei a\u00f0 kl\u00e1ra hitastigsm\u00e6lingarnar \u00fe\u00f3tt \u00e9g hef\u00f0i einhvernt\u00edma fengi\u00f0 \u00fea\u00f0 til a\u00f0 virka. \u00dea\u00f0 \u00feurfti einhverjar stillingar til sem \u00e9g gleymdi og haf\u00f0i hvergi skjala\u00f0. Svo, h\u00e9r kemur \u00fe\u00e1 skj\u00f6lunin...<\/p>\n<p>Sums\u00e9, hitastigsneminn er svokalla\u00f0ur DS18B20 nemi og \u00e9g hef s\u00e9\u00f0 tv\u00e6r \u00fatg\u00e1fur. Ein l\u00edtur \u00fat eins og venjulegur sm\u00e1ri sem au\u00f0velt er a\u00f0 stinga \u00ed brau\u00f0bor\u00f0, og svo hin sem \u00e9g er me\u00f0 sem er l\u00edtill m\u00e1lmh\u00f3lkur me\u00f0 alll\u00f6ngu skotti og \u00feremur v\u00edrum sem me\u00f0 g\u00f3\u00f0um vilja er h\u00e6gt a\u00f0 stinga einhversta\u00f0ar \u00ed, en er fremur ger\u00f0ir til a\u00f0 vera l\u00f3\u00f0a\u00f0ir fastir.<\/p>\n<p><a href=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-sensor-e1538753208589.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-36 size-large\" src=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-sensor-e1538753208589-1024x768.jpg\" alt=\"\" width=\"525\" height=\"394\" srcset=\"https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-sensor-e1538753208589-1024x768.jpg 1024w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-sensor-e1538753208589-300x225.jpg 300w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-sensor-e1538753208589-768x576.jpg 768w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<p>\u00dea\u00f0 \u00fearf a\u00f0 hla\u00f0a stu\u00f0ningi fyrir \u00feetta inn \u00ed Raspbian. Annars vegar sem \"document tree overlay\" sem m\u00e1 gera me\u00f0 \u00fev\u00ed a\u00f0 setja \u00ed skr\u00e1na\u00a0<code class=\"\" data-line=\"\">\/boot\/config.txt<\/code> l\u00ednuna:<\/p>\n<pre><span class=\"pln\">dtoverlay<\/span><span class=\"pun\">=<\/span><span class=\"pln\">w1<\/span><span class=\"pun\">-<\/span><span class=\"pln\">gpio<\/span>\r\n<\/pre>\n<p>Svo \u00fearf a\u00f0 endurr\u00e6sa v\u00e9lina og \u00fe\u00e1 m\u00e1 hla\u00f0a inn tveimur m\u00f3d\u00falum sem \u00fearf til a\u00f0 allt virki. \u00dea\u00f0 m\u00e1 hins vegar bara b\u00e6ta \u00feeim stu\u00f0ningi vi\u00f0 \u00ed <code class=\"\" data-line=\"\">\/etc\/modules<\/code> me\u00f0 \u00fev\u00ed a\u00f0 b\u00e6ta vi\u00f0 skr\u00e1na l\u00ednunum:<\/p>\n<pre>w1_gpio\r\nw1_therm<\/pre>\n<p>Svo m\u00e1 endurr\u00e6sa og \u00fe\u00e1 \u00e1 allur stu\u00f0ningur a\u00f0 vera kominn til a\u00f0 lesa hitastigi\u00f0 af nemanum.<\/p>\n<p>Neminn er tengdur me\u00f0 svarta v\u00edrinn \u00ed j\u00f6r\u00f0, rau\u00f0a \u00ed 3,3 V og gula \u00ed GPIO pinna 4. Guli pinninn \u00fearf svo a\u00f0 vera \"dreginn upp\" \u00ed 3,3 V me\u00f0 \u00fev\u00ed a\u00f0 tengja gula v\u00edrinn vi\u00f0 3,3 V tengi\u00f0\/rau\u00f0a v\u00edrinn \u00ed gegnum vi\u00f0n\u00e1m (t.a.m. 4,7 kOhm sem vir\u00f0ist vera algengt; \u00e9g hef ekki prufa\u00f0 a\u00f0 breyta um vi\u00f0n\u00e1m en \u00fea\u00f0 v\u00e6ri \u00e1hugavert a\u00f0 prufa).<\/p>\n<p><a href=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wiring-e1538753225184.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-37\" src=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wiring-e1538753225184-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wiring-e1538753225184-300x225.jpg 300w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wiring-e1538753225184-768x576.jpg 768w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wiring-e1538753225184-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> <a href=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wirings-e1538753240647.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-38 size-medium\" src=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wirings-e1538753240647-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wirings-e1538753240647-300x225.jpg 300w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wirings-e1538753240647-768x576.jpg 768w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-wirings-e1538753240647-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Hver DS18B20 nemi hefur sitt eigi\u00f0 n\u00famer svo \u00fea\u00f0 m\u00e1 jafnvel tengja fleiri en einn vi\u00f0 s\u00f6mu Raspberry Pi t\u00f6lvu. Af nemunum m\u00e1 svo lesa undir: <code class=\"\" data-line=\"\">\/sys\/bus\/w1\/devices\/28-*<\/code><\/p>\n<p><a href=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-measurement.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-47\" src=\"http:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-measurement-1024x768.jpg\" alt=\"\" width=\"525\" height=\"394\" srcset=\"https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-measurement-1024x768.jpg 1024w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-measurement-300x225.jpg 300w, https:\/\/uni.hi.is\/martin\/files\/2018\/10\/rpi-temp-measurement-768x576.jpg 768w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c9g f\u00f3r af sta\u00f0 me\u00f0 hitstigsm\u00e6lingar me\u00f0 Raspberry Pi fyrir um tveimur \u00e1rum en okkur Sn\u00e6bj\u00f6rn Gu\u00f0mundsson langa\u00f0i til a\u00f0 b\u00faa til frost\u00fe\u00fd\u00f0uklefa sem m\u00e9r&hellip;<\/p>\n","protected":false},"author":1485,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[150624],"tags":[150626,150624],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi","tag-ds18b20","tag-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/users\/1485"}],"replies":[{"embeddable":true,"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":14,"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":264,"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/posts\/31\/revisions\/264"}],"wp:attachment":[{"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/uni.hi.is\/martin\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}