Raspberry Pi 4 release 1.1 or 1.2 ? what is the diference ?

Problem:

You need to know the correct release of your Raspberry Pi but it's not possible to identify it in the board, neither the storage box neither the product technical documentation.

Solution:

Run the next command:

cat /proc/cpuinfo

Check the information in the source link to identify the release of your model using the map table in the official Raspberry Pi website

Source:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md

 

How to connect a OLED display with a Raspberry Pi

Problem:

You would like to use a OLED display with a I2C interface with a Raspberry pi using a SH1106 controller , 

Solution:

That type of OLE Display have 4 connections, just follow the next wire schema to connect it to the Raspberry.

Connect the wires directly between the oled display and the Raspberry:

OLED pins >> Raspberry Pi

VDD >> 5V

GND >> GND

SCK >> SCL  ( more information )

SDA >> SDA  ( more information)

*Check the panel in your OLED display to ensure the correct pin definition in the oled panel 

Setup the software:

Activate the I2C Interface option in system configuration, use the command raspi-config and go to interface settings, there you will fine the I2C option.

Install libraries:

Just use the following command: 

sudo apt-get install -y python-smbus 
sudo apt-get install -y i2c-tools
sudo apt-get reinstall build-essential
sudo apt-get install i2c-tools
$ sudo apt-get update
$ sudo apt-get install python3 python3-pip python3-pil libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libopenjp2-7 libtiff5 -y
$ sudo -H pip3 install luma.oled

Check if the system detect it:

You can check it if you find signal in this interface map, use the
command: sudo i2cdetect -y 1

If it works, you will see something like this:



Working with the Oled and Python:
1.- Clonning the exmaple repository:
$ git clone https://github.com/rm-hull/luma.examples.git
$ cd luma.examples

2.- install libraries
sudo -H pip install -e .

3.- run examples
cd examples
sudo python3 3d_box.py

Hardware:

You are in emergency mode. After logging in,

Problem:

you make a change in the fstab file and after reboot the systm you can see that your raspberry pi don't boot and show the next message:

"You are in emergency mode. After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to try again to boot into default mode.
Cannot open acess to console, the root account is locked.
See sulogin(8) man page for more details.
Press Enter to continue"


but, you can't do nothing to skip this message.

Solution:

the solution is to edit fstab system file and remove the last change or remove all and leave it with default values, follow the instruction that Talha Sariyürek explain in this blog post:

https://talhasariyuerek.com/en/linux-raspberry-pi-3b3b4-emergency-mode-root-account-locked-solution/

Control RGB Led Strip using Mosfet

Problem:
You are interested in controlling a led RGB strip with a raspberry but it's not clear how to setup Mosfet because there are people that use 1 resistor, 2 resistors, others without resistors, the scheme is quite different, etc... 


Solution:
If you would like to use Mosfet as a switch to control a RGB led strip,it is recommended to use resistors in the gate port, one to the source and other to pump.
I use and old P30N06LE and it works well, as I can see everyone is using the IRLZ34N, it's important to read the mosfet datasheet Gate to Source Voltage value in the mosfet to ensure the volts needed to activation.

Circuit diagram with 2 resistors

Connection map with 1 resistor in Mosfet gate

Sources:

With 1 resistor:
http://www.knight-of-pi.org/color-mixer-control-a-rgb-led-strip-with-the-raspberry-pi-and-the-n-channel-mosfet-irlb8721/ 

Note:
Take in consideration that using a led strip, it's required to power them with a 12v power supply, if you put any wire in the wrong position,  your raspberry pi will die like mine :-) 


coding python for GPIO

Problem:
How to control electronic component connected to the GIO board ? 

Solution:
Follow the instruction of the electronic component, for exmaple led light need to be connected in serial with a resitant, active buzzers can be connected directed between the gpio output and the gnd pin.
once you have connected the electronic component, follow the next code structure to control it:

import RPi.GPIO as GPIO
import time

v_compo = 10

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(v_compo, GPIO.OUT)

print("LED on")
GPIO.output(v_compo, 1)
time.sleep(v_sleep)

print("LED of")
GPIO.output(v_compo, 0)
time.sleep(v_sleep)


No module named RPi

Problem:
when you try to run the program, you face with error message "No module named 'RPi'"

Solution:
Install missing libraries following the next steps:
sudo apt-get install python-pip
sudo apt-get install python3-rpi.gpio   (on Python 3)
sudo 
pip freeze | grep RPi
sudo apt-get install picap

Source:
https://raspberrypi.stackexchange.com/questions/60774/importerror-no-module-named-rpi

Clone github repository with raspberry pi

Problem:
You are iterested to use a custom development from a github repository in your raspberry pi, after this clone process you can sync your raspberry with the new development.

Solution:

First, install GIT on raspbian:
sudo apt update
sudo apt install git
git --version
Follo the next steps:
1.- git clone https://github.com/raspberrypi/userland.git
2.- cd userland/host_applications/linux/apps/raspicam/
3.- time userland/build/bin/RaspiStill --exposure verylong --shutter 140
00000 -t 16000 -o test.jpg

Examble:
This git is to change functionality of raspberry pi camera, in this case you can get more exposure time.