Jump to content

BananaPi M1 with Armbian 21.02: One-Wire Temperature Sensor and TV output

Recommended Posts

I found that it is not easy to use the Dallas one-wire temperature sensors
and the composite TV-Out on the Banana Pi with the current Armbian version.


I have searched for posts on these topics in the forum.

The posts that I have found in this forum describe solutions
for outdated Armbian versions or do not give enough detail. The
following posts in this thread will describe how to solve these problems for the current
Armbian version for the Banana Pi M1.

Link to comment
Share on other sites

BananaPi M1 with Armbian 21.02: How to Enable Dallas One-Wire Temperature Sensor


The following step-by-step guide may be too detailed:


1) Write the Armbian image for Banana Pi to SD card.


xzcat <~/Downloads/Armbian_21.02.3_Bananapi_buster_current_5.10.21.img.xz | sudo dd of=/dev/mmcblk0 bs=1M


2) Set host name of the Banana Pi


Pop out SD card out of the laptop / PC and push back in.
# Replace occurrences of bananapi with desired hostname.

sudo sed -i s/bananapi/test-w1/ /media/*/*f*/etc/host{s,name}

# umount sdcard, put in banana pi, Connect banana pi to network, power on


3) SSH to Banana Pi and Configure 1Wire

ssh root@test-w1
# Follow instructions to change password and create user. Reconnect as user.
sudo armbian-config
# Navigate: System -> Hardware. Select w1-gpio. Save. Back. Reboot.
# Reconnect after reboot as user.
dmesg | grep wire
[    8.560693] Driver for 1-wire Dallas network protocol.
[    8.581436] gpio-271 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file
[   60.628063] w1_master_driver w1_bus_master1: Attaching one wire slave 00.800000000000 crc 8c

cat /sys/kernel/debug/pinctrl/*/pinmux-pins
Pinmux settings per pin
Format: pin (name): ...
pin 271 (PI15): onewire@0 1c20800.pinctrl:271 function gpio_in group PI15

GPIO 271 does not seem to be available on the GPIO header of the BananaPi.


For Linux, GPIO seem to either have a (high) number, or a name like PH8 or PI15.

I have only found one source that shows the location of these type of pin names on the
Banana Pi's GPIO Header: The table at the bottom of this page: http://www.elektronik-kompendium.de/sites/raspberry-pi/1907101.htm

If gives this mapping for the Banana Pi M1 GPIO Header to these names:

3V3   1    2 5V
PB21  3    4 5V
PB20  5    6 GND
PI03  7    8 PH00
GND   9   10 PH01
PI19 11   12 PH02
PI18 13   14 GND
PI17 15   16 PH20
3V3  17   18 PH21
PI12 19   20 GND
PI13 21   22 PI16
PI11 23   24 PI10
GND  25   26 PI14

This shows that  PI3 (which is the same as PI03) is available at pin 7.


In order to use this pin for one-wire, edit file /boot/armbianEnv.txt
on the banana pi. Add a line:




Save and reboot. Connect a temperature sensor to 3V3, GND, pin 7, and a
suitable resistor.  Then the temperature can be read by

cat /sys/bus/w1/devices/w1_bus_master*/28-*/temperature


Link to comment
Share on other sites

BananaPi M1 with Armbian 21.02: How to Enable TV Output through the Composite Connector


A Banana Pi M1 set up as in the previous post, when connected to a display via
the composite connector, will display only early boot messages.


When the linux kernel is started, the display at the composite connector will
go dark, and video will only be output through HDMI.


To prevent this, blacklist the HDMI output module:


echo blacklist sun4i_drm_hdmi | sudo tee /etc/modprobe.d/composite.conf

However, in the current kernel, the HDMI output not compiled as a module, and therefore cannot be effectively blocked in this way.


But it was compiled as a module in Armbian kernel version 5.8.6. Use

sudo armbian-config

to install this kernel version (under System -> Other) and reboot. The screen (console) will now show on the screen attached to the composite output.


Security-wise, changing to an older kernel is probably a bad move. For devices that need to access the internet, it may be better to recompile the current kernel instead after configuring that the above driver is compiled as a module. As this is not a concern for me, I have not tried this.


Link to comment
Share on other sites

5 hours ago, SomeArmbianForumUser said:

As this is not a concern for me, I have not tried this.

I think this opens new problem, but I can't recall what is the reason. It was as a module, but we have to change it https://github.com/armbian/build/commit/4a57ba0189d831953bad6ea56b65ba487d0149b4#diff-6207111e1940f2332b7a21e4459e1bccd91f7c4c66003ce20bf51a9b0ac71509

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines