В предыдущей статье мы считывали показания датчика DS18B20 без использования драйверов, написав собственную программу на C++. В этой статье мы попробуем настроить 1-Wire драйвер и, с его помощью, получить температуру с DS18B20, подключенного к Orange Pi PC.
Операционная система Armbian 5.35 (Ubuntu 16.04) имеет драйвер для работы с 1-Wire устройствами, а именно с датчиком температуры DS18B20. По умолчанию этот драйвер отключён и по этому нужно его настроить.
О наличии этого драйвера в других операционных системах (не Armbian) я не знаю, не проверял.
Настройка драйвера 1-Wire
- Для начала сделайте резервную копию script.bin, чтобы, в случае чего, вы смогли вернуть обратно все настройки:
sudo cp /boot/script.bin /boot/script.bak
- Преобразуйте бинарный файл script.bin в редактируемый файл fex:
bin2fex /boot/script.bin /boot/script.fex
- Теперь отредактируйте файл script.fex с помощью утилиты nano:
nano /boot/script.fex
- Найдите раздел [w1_para] и отредактируйте строки w1_used и gpio:
[w1_para] w1_used = 1 gpio = 20
где gpio — это номер пина по колонке BCM. Чтобы узнать, где и какой пин находится, выполняем gpio readall. В моём случае BCM=20, т.е. 37-й физический пин.
- Сохраните и закройте файл:
Ctrl X, Y (Yes), Enter
- Преобразуйте измененный script.fex в script.bin:
sudo fex2bin /boot/script.fex /boot/script.bin
- Отредактируйте файл /etc/modules с помощью утилиты nano:
nano /etc/modules
- Добавьте следующие строки:
w1-sunxi w1-gpio w1-therm
- Сохраните и закройте файл:
Ctrl X, Y (Yes), Enter
- Перезагрузите систему:
reboot
Схема подключения датчика DS18B20 к Orange Pi PC
Считывание температуры с датчика DS18B20
После перезагрузки выполняем команду:
dmesg | grep -E 'w1|wire'
вы должны получить примерно такой результат:
root@orangepipc:~# dmesg | grep -E 'w1|wire' [ 5.375196] W1_SUNXI: Added w1-gpio on GPIO-20 [ 5.379420] Driver for 1-wire Dallas network protocol.
Это означает, что драйвер 1-wire настроен на 20-й пин.
Чтобы увидеть все подключённые датчики выполняем:
ls -al /sys/bus/w1/devices
У меня два датчика, 28-000005464e04 и 28-00000547cabb:
root@orangepipc:~# ls -al /sys/bus/w1/devices total 0 drwxr-xr-x 2 root root 0 Dec 3 19:59 . drwxr-xr-x 4 root root 0 Dec 3 19:59 .. lrwxrwxrwx 1 root root 0 Dec 3 20:02 28-000005464e04 -> ../../../devices/w1_bus_master1/28-000005464e04 lrwxrwxrwx 1 root root 0 Dec 3 20:02 28-00000547cabb -> ../../../devices/w1_bus_master1/28-00000547cabb lrwxrwxrwx 1 root root 0 Dec 3 19:59 w1_bus_master1 -> ../../../devices/w1_bus_master1 root@orangepipc:~#
Температура и crc записаны в файле w1_slave каждого датчика и, чтобы узнать её, выводим на экран содержимое этого файла:
cat /sys/bus/w1/devices/28-000005464e04/w1_slave
результат:
61 01 4b 46 7f ff 0f 10 02 : crc=02 YES 61 01 4b 46 7f ff 0f 10 02 t=22062
Добрый день
orange pi one. стоит образ armbian от orangepi pc (на сайте написано что они подходят)
uname -a
4.14.70-sunxi #265 SMP Wed Sep 19 10:01:19 CEST 2018 armv7l GNU/Linux
cat /etc/modules
w1-sunxi
w1-gpio
w1-therm
gpio-sunxi
script.bin в нем нет, но в armbian-config нашел включение 1ware
после чего:
1
dmesg | grep -E ‘w1|wire’
[595233.277311] w1_master_driver w1_bus_master1: Attaching one wire slave 00.cd3400000000 crc 21
[595233.284890] w1_master_driver w1_bus_master1: Family 0 for 00.cd3400000000.21 is not registered.
[595259.558238] w1_master_driver w1_bus_master1: Attaching one wire slave 00.2d3400000000 crc c8
[595259.565671] w1_master_driver w1_bus_master1: Family 0 for 00.2d3400000000.c8 is not registered.
[595321.800421] w1_master_driver w1_bus_master1: Attaching one wire slave 00.ad3400000000 crc 44
[595321.807568] w1_master_driver w1_bus_master1: Family 0 for 00.ad3400000000.44 is not registered.
….
и таких записей с разным slave и src еще сотни полторы. Все начинаются с 0
ls -al /sys/bus/w1/devices
total 0
drwxr-xr-x 2 root root 0 Oct 28 06:02 .
drwxr-xr-x 4 root root 0 Oct 28 05:48 ..
lrwxrwxrwx 1 root root 0 Oct 28 06:03 00-1d3400000000 -> ../../../devices/w1_bus_master1/00-1d3400000000
lrwxrwxrwx 1 root root 0 Oct 28 06:03 00-ed3400000000 -> ../../../devices/w1_bus_master1/00-ed3400000000
lrwxrwxrwx 1 root root 0 Oct 28 05:48 w1_bus_master1 -> ../../../devices/w1_bus_master1
при этом датчик подключен один (к 37 ноге)
и id иногда сменяются. бывает что их 3
ни в одной папке нет файла w1_slave
Поможете разобраться?
В ядре linux 4.14 Вам не нужно редактировать файл
fex
, но файл/boot/armbianEnv.txt
и добавлять строки:Подключите пины данных устройств к PB20 (это 37-й) gpio и продолжайте, как Kernel 3.4.
Материалы
https://docs.armbian.com/User-Guide_Allwinner_overlays/#example-bootarmbianenvtxt-contents
http://linux-sunxi.org/1-Wire#Linux_kernel_4.14
В orange Pi One нет столько gpio
поставил pin=PB4
что соответсвует 7 на железке
но всё ранво проблема как у Сергея.
:root@orangepione:~# uname -a
Linux orangepione 4.19.38-sunxi #5.85 SMP Wed May 8 14:20:48 CEST 2019 armv7l GNU/Linux
root@orangepione:~# dmesg | grep -E ‘w1|wire’
[ 4.951522] Driver for 1-wire Dallas network protocol.
[ 4.983972] gpio-110 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file
[ 6.836926] w1_master_driver w1_bus_master1: w1_search: max_slave_count 64 reached, will continue next search.
[ 53.531830] w1_master_driver w1_bus_master1: Attaching one wire slave 00.800000000000 crc 8c
[ 53.535548] w1_master_driver w1_bus_master1: Family 0 for 00.800000000000.8c is not registered.
root@orangepione:~#
Проверяется всё очень легко, находим схему платы, в данном случае — это Orange Pi One

http://linux-sunxi.org/images/7/7e/ORANGE_PI-ONE-V1_1.pdf
и находим раздел Ext Port (это последняя страница), а тут есть CON3 DIP40-254, т.е. GPIO гребёнка:
и видим, что выводы общего назначения у нас следующие: PA7, PA8, PA9, PA10, PA20, PA21, PD14, PC4 и PC7. Должен быть ещё и PWM1, что соответствует 7-му пину, но, думаю, у него другая роль.
Интересно ведь в readAll данные пины идут для SPI
форматирование корявое, но скрин не могу залить 🙁
если правилльно понял то допустим если я хочу использовать PA20, то мне в armbianEvn написать :
param_w1_pin=PB11 ?
Попробуйте написать PA20 так, как указано на схеме, если не пойдёт, тогда я попробую сделать на своей плате и отпишусь попозже.
А.С. Если хотите добавить картинку, тогда вставьте адрес/url с расширением jpg png или bmp и картинку будет видно. Ещё можно использовать тэг < pre >, чтобы вставить текст из терминала
А у вас точно Orange Pi One? Гребёнка на One на 40 выводов, а вы, мне кажется, установили не правильную версию WiringPi или у вас Orange Pi Zero?
у меня именно One, видимо неправильно установил Wiring. Хотя не думал, что его можно как-то неправильно установить. Попробую переставить.
Смотри тут: Установка и настройка WiringOP/WiringPi на Orange Pi PC тебе нужно для H3
Cпасибо, переставил Wiring и поставил на PD14. Все работает!
После перезагрузки всё работает точно так-же:
чтобы увидеть все подключённые датчики:
и температура:
Linux orangepipcplus 4.19.20-sunxi #5.75
С датчиком разобрался — работает, но есть один вопросик :
Вы случаем не знаете как переключить разрешение датчика
на 10-11 битное преобразование, а то он похоже на 9 битах.
А вы при какой температуре это выяснили? Просто я не проверял при больших и отрицательных температурах
При комнатной, у вас кстати примером выше тоже похоже — 20750, т.е. точность 0.25 градуса.
И кстати он предложил подключить датчик на 110 порт (PD14) и на другие не соглашался.
Менять разрешение я никогда не пробовал, почему-то об этом не подумал.
Я посмотрел исходники и обнаружил, что меняется с помощью функции
но нужно как-то её вызывать, но ещё не разобрался как.
https://elixir.bootlin.com/linux/latest/source/drivers/w1/slaves/w1_therm.c
Я во всяких никсах и программировании не очень, так что если вам удастся придумать как — будет вам большой респект 😉
Я постараюсь найти решение этой проблемы и дополню статью, в случае успеха.
Да и кстати в начале темы все ок (где температура t=22062, т.е. 22.062 °C.) т.е. преобразование с большим разрешением, интересно почему. Другая версия драйвера ?
показываются не все цифры, только 3, реальные данные вот эти: 22.0625
По опыту общения с 18b20 насколько я понял все просто
9бит -точность 0.25
10 — 0.1
11-0.01
Ну да, просто вот вопрос, почему на Kernel 3.4. идет преобразование наверно 12 бит, а на 4.14 — 10 бит.
Как установить разрешение DS18B20 на Armbian / Версия ядра Linux 4.x
На ядре 3.4.x можно только получить температуру с DS18B20. В новой версии ядра Linux 4.x немного исправлены тайминги, достигнута стабильная работа датчиков в режиме паразитного питания, а также добавлена опция изменения разрешения.
Теперь вы можете легко установить разрешение 9, 10, 11 или 12 бит с помощью простой команды:
Соответственно при снижении разрешения значительно уменьшается время отклика сенсора с 1100 мс (с 12 бит) до 125 мс (с 9 бит).
Если у вас версия ядра ниже 4.x, тогда вы получите следующую ошибку:
https://forum.armbian.com/topic/3276-help-wanted-changing-resolution-of-ds18b20-on-orange-pi/
https://forum.armbian.com/topic/1558-w1-therm-driver-modifications/
https://raspberrypi.stackexchange.com/questions/71563/how-to-set-precision-of-ds18b20-via-w1-therm
https://github.com/raspberrypi/linux/blob/rpi-4.9.y/Documentation/w1/slaves/w1_therm
Может просто со старого какой-нить файлик вытащить и переставить на новый?
Я пока не могу дать ответ на этот вопрос, вечером попробую экспериментировать, сейчас у меня нет доступа к апельсинке
На orange pi pc после установки свежего armbian 21.05.1
просто запускаем armbian-config -> System -> Hardware
в самом низу чекаем w1-gpio
сохраняем, получаем предложение перезагрузки и после чего
на PD14 получаем данные.
В node-red узел node-red-contrib-sensor-ds18b20
сразу читает данные с этого пина.
В ядре 5.10.34-sunxi:
в /boot/armbianEnv.txt
добавляем:
overlays=w1-gpio
param_w1_pin=PA20
param_w1_pin_int_pullup=1
инфа отсюда: https://docs.armbian.com/User-Guide_Allwinner_overlays/
Dogs with CICT frequently present with evidence of a bleeding disorder, including bruising, blood in stool or urine, and nose bleeds real cialis no generic
You might encounter real money online poker sites that advertise themselves to players from Maryland, but be aware these sites do not operate within Maryland or US laws or regulations. Such offshore poker sites are located outside the country and therefore do not abide by Maryland gambling laws. Reputation — When it comes to the online poker community, you’re only as good as your reputation. Some poker rooms have spent years treating their players fairly, while other sites have reputations for cutting corners and taking their customers for a ride. You will easily recognize licensed operators in the state as they will always display the MGCB license seal on the site, usually at the very bottom. You can always double-check this information by visiting the MGCB site and looking for the particular operator to see if they have a valid license.
https://lupduptrader.com/comunidad/profile/oxojulius83287/
No Deposit Casinos are real money online casinos that are free to play. You can play for free at just about any online casino. It might sound like a joke but it is absolutely possible to play online without making one single deposit. To get the most out of the best casino games online for free you should play at one of the no deposit bonus casinos listed on this page. A welcome bonus, also sometimes referred to as a match bonus, applies to players who make an initial deposit. Some of these bonuses can be for up to $1,500 and make for a great way to get started on a real-money online poker site if you intend to play a lot of poker. Meeting the clearing requirements for some welcome bonuses – particularly the largest amounts – will take some concentrated effort in a short period of time.
Si buscas un casino en línea que tenga un tema divertido con colores brillantes, que podría ser cualquier cosa. Los temas cómicos también son muy populares, póker bono sin depósito desde una billetera electrónica. Thunderpick recompensa a los jugadores con obsequios regulares de tarjetas de regalo que pueden ser de hasta 150 euros para los jugadores más leales, por supuesto. Las slots son máquinas de premio, uno de los juegos de azar online más populares. También se las conoce como tragaperras online o máquinas tragamonedas. Es España es muy común encontrarlas en bares y salones de juego. Las slots online son una evolución de las clásicas máquinas tragaperras, que están reguladas por las autoridades, y te ofrecen la comodidad de poder jugar desde cualquier lugar, siempre que tengas acceso a tu ordenador, teléfono móvil o Tablet.
http://sunginew.com/bbs/board.php?bo_table=free&wr_id=21010
Jugué en la ruleta de bajo riesgo. En esa ruleta la apuesta mínima son 50 céntimos y la máxima, 500 euros. Para que vea lo rápido que es crear una ruleta aleatoria, les dejo este vídeo-tutorial para crear una ruleta en Flippity: Mientras juegas a la ruleta en directo, podrás hablar con el crupier y comunicarte tanto con él como con otros jugadores, gracias a nuestro chat. Recomendamos a la Comunidad Educativa Digital tener en cuenta que, el enlace y o la carpeta en donde están alojados los libros, recursos y o materiales, no es administrado por la Web del Maestro CMF, pueda ser que en cuestión de días (o según el tiempo transcurrido desde su publicación), los enlaces no funcionen y el material ya no se encuentre disponible. Gracias por su comprensión.
Get the best viral stories straight into your inbox! You can bet on NHL hockey in Canada by choosing one of the top online bookies and creating a valid account. Ensure you pick a bet type you understand and enter the amount to wager on the NHL team. If you’re new to betting on the competition, take time to learn about the various teams and players for a better chance of winning the wager. Betting on the NHL is quick and easy and that’s from the Moneyline on individual matches, to longer futures picks like Divisional and Conference winners. Along with the Moneyline, there are a couple of other main NHL betting markets to consider. Signing up for an account and betting on the NHL online has never been easier or quicker. The first thing to do is to make sure sports betting is legal where you live.
https://edgarjigo890962.thezenweb.com/espn-over-under-nba-53439752
Golden State had the eighth-best odds heading into last season at +2500 to win the championship, according to Basketball-Reference. There are many strategies to consider when making an NBA futures bet on which team will win the championship. Obviously, you’re looking to bet on who you think can navigate through the NBA playoffs and come out on top. So just because a team is in first place at the NBA All-Star break, it doesn’t mean that’s the best roster to win in the postseason. Brooklyn may not even make the playoffs, but have the second-best odds to reach the Finals due to the abilities of Kevin Durant, Kyrie Irving, and perhaps Ben Simmons. Those odds are even better than Philadelphia’s, a team that boasts a leading MVP candidate in Joel Embiid and a former MVP James Harden. Boston and Miami are right in there as well.
It’s quite a multi-tasker: can be used to improve skin moisturization, as a solvent, to boost preservative efficacy or to influence the sensory properties of the end formula. } Aside from that, I’m absolutely a label reader when it comes to adding new skincare products into my routine. JAYJUN Eye Patch’s ingredient list contains many of my favorites that can be found on the front of the list. Here are a few of them: Country of manufacture: Korea After cleansing and toning, apply the patches on desired areas using the spatula. Remove after 20-30 minutes, and gently pat the skin to help with absorption. Functionality: Moisturizing, Whitening, Smoothing It’s not only soothing but it’ also skin-softening and protecting and can promote wound healing.
https://www.bookmark-help.win/urban-decay-kajal-review
Our Makeup Brands Before adopting my son, an extremely large mutt named Scorpion, I would spend my mornings luxuriating in painting bold shapes on my lids. Then, I’d take no less than five minutes loading up my lashes with so much mascara that people would mistake them for lash extensions. The process and its results were meditative and gorgeous but not so realistic anymore. Now, I prefer speedy swipes of L’Oréal Paris’ latest mascara launch before taking Scorpion on a walk. Before adopting my son, an extremely large mutt named Scorpion, I would spend my mornings luxuriating in painting bold shapes on my lids. Then, I’d take no less than five minutes loading up my lashes with so much mascara that people would mistake them for lash extensions. The process and its results were meditative and gorgeous but not so realistic anymore. Now, I prefer speedy swipes of L’Oréal Paris’ latest mascara launch before taking Scorpion on a walk.