Disabling IPv6 Kernel Module on Raspbian Stretch

I’m using Raspbian Stretch Lite (September 2017 version) and for some reason, wanted to disable IPv6 kernel module, which is loaded by default. Basically, it can be done by blacklisting the kernel module. [1]

Here is steps I took.


1. Check already loaded modules (Optional)
You can check already loaded modules by ‘lsmod’ command. IPv6 appears at the last line of the example below.


2. Blacklist IPv6 kernel module
Open the configuration file,

and add the line below.

Save, and close.


3. Reboot
Restart the system to unload the kernel module.


4. Verify
Check the loaded modules again. ‘ipv6’ should be gone if everything is done properly.


1. How to disable loading of unnecessary kernel modules



Setting Up Serial Communication between Raspberry Pi and PC

This post shows how to setup serial communication between Raspberry Pi and PC using a USB-Serial cable.

Here is the list of contents of this post.



These are required things for this post.

  • Raspberry Pi board : Any Raspberry Pi should work. In this post, Raspberry Pi 3 running Raspbian Stretch is used.
  • PC : The other endpoint. In this post, a Windows 10 PC is used.
  • USB-serial cable : USB to Serial UART converter cable such as this. Make sure the signal voltage level is correct.
  • 3 jumper wires (male-female) : to connect Raspberry Pi’s GPIO pins and USB-Serial cable.

Also, terminal emulator programs are used both on Raspberry Pi and PC to send/receive data.

  • minicom : Text-based terminal emulator on Raspberry Pi.
  • Termite : Terminal emulator on Windows PC.


1. Wiring
1-1. Connect jumper wires to USB-Serial cable for Tx, Rx, and GND.

1-2. Connect the other side of jumper wires to Raspberry Pi’s GPIO pins. Check this useful site for pinout.

1-3. Connect USB-Serial cable to USB port on PC


2. Setting up terminal emulator on Windows PC
To send and receive serial data, let’s install and setup a terminal emulator program on PC.

2-1. Download and install Termite.

2-2. Open “Device Manager” and check the COM port number USB-Serial cable is using. In the case below, it’s COM7.

2-3. Launch Termite and click on “Settings” button.

2-4. Select Port number you checked on step 2-2.

2-5. Select “115200” as Baud rate.

2-6. Select “Append CR-LF” in “Transmitted Text”.

2-6. Click on “OK”.


3. Enabling UART on Raspberry Pi
3-1. Open “/boot/config.txt”.

3-2. Add the lines below at the end of the file.

3-3. Reboot.

3-4. Check the output of Termite on PC. It should be something like this:


4. Disabling console service
Now, UART connection between Raspberry Pi and PC is established. However, Raspberry Pi’s UART is used by console by default as you saw in the output on step 3-4. So, the next step is to disable the console.

4-1. Disable serial-getty service.

4-2. Open “/boot/cmdline.txt”.

4-3. Remove “console=serial0,115200”, then save the file.

4-4. Reboot.


5. Setting up terminal emulator on Raspberry Pi
To send and receive data on Raspberry Pi, we’ll use minicom, a text-based terminal emulator.

5-1. Install minicom.

5-2. Type below to launch minicom and connect to UART.

You should see like below:


6. Test
Type something in minicom and Termite. If everything is fine, you should see like below.

– Termite on Windows PC

– minicom on Raspberry Pi

  • If you want to see what you typed on minicom, turn on Local Echo by typing Ctrl-A, then E. (which I did)
  • You can exit minicom by typing Ctrl-A, and X, then select “Yes”.



Waking Up Raspberry Pi Using Reset Pin

This post shows steps to wake up Raspberry Pi 3 from other Raspberry Pi by using RUN (reset) pin.

Background: I was looking for a way to wake up my Raspberry Pi 3 from other device and found the information below,

  • Resetting the board while in halt state wakes Raspberry Pi up [1]
  • Raspberry Pi 3 has reset pin, which is labeled as ‘RUN’ [2]

As described in [1] and [2], momentarily shorting ‘RUN’ pin with GND causes a reset and it also wakes up Raspberry Pi if it’s in halt state. I found many people have implemented a reset button by using “Normally Open” (NO) / “Momentary-ON” button switch [3] [4] , but my intention was to control the reset pin from the other device. So, I decided to connect ‘RUN’ pin to the other device’s GPIO to control it. I chose another Raspberry Pi as the ‘other device’ for quick test purpose so that I don’t need to worry about the difference of logic level, etc.


Here is the list of contents of this post.

– Assumptions
– Steps
1. Wiring boards
2. GPIO control
3. Put Raspberry Pi 3 into Halt state
4. Test
– Summary
– Troubleshoot
– Reference




1. Wiring boards
1-1. Since the headers for the reset pins are not installed by default, solder it first.


1-2. Connect RUN pin and a GPIO pin between the two boards. I connected RUN with pin#7 on Pi Zero, but any available GPIO should work.

1-3. Connect GND pins between the two boards to match the ground voltages. I used pin#6 on Pi Zero, but any other GND pin should work.


2. GPIO control
2-1. Boot up Raspberry Pi Zero W and login.

2-2. Launch python interactive shell by typing ‘python’.

2-3. Import GPIO library and set GPIO mode.

2-4. Set pin#7 as output and initialize the state as HIGH.

2-5. Type three lines below to define a function to momentarily output LOW.

Note that the line 2 and 3 need an indentation at the beginning.

2-6. After entering line 3 above, press enter again to finish the function definition. The output should be like:


3. Put Raspberry Pi 3 into Halt state
3-1. Boot up Raspberry Pi 3 and login.

3-2. Type below so that it goes to halt state.


4. Test
4-1. Go back to python interactive shell on Raspberry Pi Zero and call ‘reset()’ function.

If everything is fine, Raspberry Pi 3 should boot up from halt state.


I used Raspberry Pi Zero for quick test purpose. If you intend to connect other board, please check the electrical specs such as logic levels, to avoid any damage to the boards.


1. Embedded Linux Wiki / RPI safe mode / Wake from Halt

2. Embedded Linux Wiki / RPi Low-level peripherals / P6 header

3. Making a Reset Switch for your Rev 2 Raspberry Pi

4. Reset button switch off my Raspberry Pi3



Running BLE GATT Server Example on Raspbian Stretch

The purpose of the steps below is to run Bluetooth Low Energy GATT server example code from BlueZ source code on Raspberry Pi running Raspbian Stretch.

Here are the contents of this post.

– Assumptions
– Steps
1. Download Example Code
2. Execute Example Code
3. Start Advertising BLE
4. Verify
– Reference


Here are some assumptions before start. Please refer this in case it’s not ready.


1. Download Example Code
1-1. Download BlueZ 5.43.

1-2. Extract the file.

The GATT server example code “example-gatt-server” is in “test” directory.


2. Execute Example Code
2-1. Execute BLE GATT server example code.

2-2. Check the output. If everything is fine, it should be like this:

Now, the GATT server is running. Since the example code implements “Fake Battery service that emulates a draining battery”, it outputs “Battery Level drained” message on the console every 5 seconds.


3. Start Advertising BLE
The next step is to start advertising in order to be detected by other devices. To make the steps easier, I’ll use hciconfig command. If you want to use dbus interface instead of hciconfig, please refer this post to run BLE advertising example code (i.e. example-advertisement).

3-1. Open other terminal and type below to start advertising.

Type below in case you need to stop the advertisement,


4. Verify
To verify, you can use smartphone apps such as “LightBlue”.


– example-gatt-server\test – bluez.git – Bluetooth protocol stack for Linux