Thursday, February 21, 2019

A funny python library: pyjokes

pyjokes is a funny python library to to tell a random one line jokes for programmers.

To install pyjokes for python 3:
$ pip3 install pyjokes

To install pyjokes for python 2:
$ pip install pyjokes

In python you can get a random joke by calling pyjokes.get_joke()..
Example to try on Python 3 Shell:
>>> import pyjokes
>>> pyjokes.get_joke()


Wednesday, February 20, 2019

Check glibc version

To check the glibc version in Raspberry Pi/Raspbian, simple enter the command in Terminal:

$ ldd --version

Work on Raspberry Pi/Raspbian:

Also work on Linux Mint:

Tuesday, February 19, 2019

Install Arduino IDE on Raspberry Pi/Raspbian Stretch

This video show how to Install Arduino IDE 1.8.8 on Raspberry Pi 3 B+/Raspbian Stretch. Such that you can program Arduino board on Raspberry Pi.


Setup under test:
Board - Raspberry Pi 3 B+
OS - Raspbian Stretch with desktop and recommended software (Version:November 2018, Release date:2018-11-13)
IDE: Arduino IDE 1.8.8 (Linux ARM)
Arduino Board: Mega 2560

In order to capture the screen action, I remote control the Raspberry Pi from Windows 10 via VNC viewer.

The steps is very straightforward:

- Visit Arduino Download page, download Arduino IDE of Linux ARM.

- After download completed, extract the downloaded file.

- Run the install script:
$ sudo ./install.sh

- After finished, you can run the Arduino IDE in Raspbian desktop Menu -> Programming -> Arduino IDE.

In my case the following error reported when run install.sh:
touch: cannot touch '/root/.local/share/applications/mimeapps.list': No such file or directory
/usr/bin/xdg-mime: 803: /usr/bin/xdg-mime: cannot create /root/.local/share/applications/mimeapps.list.new: Directory nonexistent

It may be caused by mis-located of the file mimeapps.list. Actually the install.sh only add the desktop shortcut, menu item and file associations for Arduino IDE. This error should not affect the functionality. Alternatively, you can run the IDE by switch to the extracted directory, and run the arduino directly.


Add Arduino core for ESP8266 WiFi chip to Arduino IDE:

Arduino core for ESP8266 WiFi chip brings support for ESP8266 chip to the Arduino environment. It lets you write sketches using familiar Arduino functions and libraries, and run them directly on ESP8266, no external microcontroller required.

ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, work with SD cards, servos, SPI and I2C peripherals.

Once Arduino IDE installed, you can follow the same steps in my old post to "Add Arduino core for ESP8266 to Arduino IDE (run on Raspberry Pi/Raspbian Jessie with PIXEL)".


reference:
Arduino core for ESP8266 WiFi chip project page: https://github.com/esp8266/arduino
Additional Board Manager URLs:
http://arduino.esp8266.com/stable/package_esp8266com_index.json


Arduino core for ESP32 WiFi chip is another similar project to bring support of ESP32 to Arduino IDE. It can be installed to Arduino IDE by following the same step on normal PC. But, I tried to install it to Arduino IDE on Raspberry Pi, it fail due to "Tool xtensa-esp32-elf-gcc is not available for your operating system"!


reference:
Arduino core for ESP32 WiFi chip project page: https://github.com/espressif/arduino-esp32
Additional Board Manager URLs:
https://dl.espressif.com/dl/package_esp32_index.json




Identify my Raspberry Pi board version

To identify the version of your Raspberry Pi, you can enter the command:

$ cat /proc/cpuinfo

The last three lines show the hardware type, the revision code, and the Pi's unique serial number.


Then browse Raspberry Pi DOCUMENTATION > HARDWARE > RASPBERRYPI > REVISION-CODES. You can search your hardware revision to find out the version of you board.

My board is Raspberry Pi 3 B+



Related:
How to check Raspberry Pi 4B reversion 1.2, it provide more option to check your board version.

Thursday, February 7, 2019

Raspberry Pi: Stream video to VLC player, using rtsp protocol.

Stream Camera Module video to network and play the streaming video using VLC player, using rtsp protocol.


In this video:
I enter Raspberry Pi command via VNC Viewer running on Windows 10 to control Raspberry Pi Zero W with VNC enabled, to stream camera video to network using rtsp protocol. In PC side, view the streaming video using VLC Media Player.

In Raspberry Pi side:
Setup under test:
board: Raspberry Pi Zero W
Camera Module: Raspberry Pi Camera Rev 1.3
OS: Raspbian Stretch with desktop and recommended software, release 2018-11-13

Enter the command:
$raspivid -o - -t 0 -n -w 320 -h 240 -fps 30| cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8000/}' :demux=h264

where
-w 320 : width=320
-h 240 : height=240
-fps 30 : 30 frame per second
8000 : the port to stream video

PC side:
OS: Windows 10
Player: VLC Media Player 3.0.6

Open VLC Media Player, click Media > Open Network Stream... > Select Network tab, enter: rtsp://192.168.1.13:8000/

where
192.168.1.13 : the IP of the Raspberry Pi
8000 : the streaming port set at Raspberry Pi side


Tested again@2021-01-01:

The first Raspberry Pi Store opened in Cambridge

Raspberry Pi open its first "experimental space" in Cambridge, the first floor in the Grand Arcade.


The Raspberry Pi Store is a place where you can experience and buy Raspberry Pi products. Explore some of the things you can do with a Pi, discover our accessories and books, and get your hands on store-only exclusives.

"There's always a risk you can get complacent about your customers, but a physical store means we have a place for people, who are curious about Raspberry Pi, to experience it," Mr Upton, chief executive of Raspberry Pi Trading, said.


For more information, visit
Raspberry Pi Blog.
The Raspberry Pi Store webpage.

#RPiStore