Tor Browser for Raspberry Pi

Tor Browser:

I don’t plan on doing a ton of web-browsing on this system, but it’s useful for accessing information, including this WordPress site.  I heard about Tor in the past, and don’t plan on doing anything top secret, but never used it.  One side benefit maybe less spam.  Another side benefit is that I believe this is one of the best app installers for Raspberry Pi.  As an experiment, I’m going to install on my new Raspberry Pi 5 setup.  When it’s all installed, it’s easy to download the latest Tor Browser from the: Menu, Internet, Tor Browser Nightly menu.

Sourcing the installer (Pi-Apps):

-Looks like the 64-bit version is still in development, and the Raspberry Pi folk are OK with using Pi-Apps for sourcing the latest from Sourceforge, and then installing.  Other option is to do it manually with tar files, but then I’m on my own for updates.

-Open terminal and enter the following:

wget -qO- https://raw.githubusercontent.com/Botspot/pi-apps/master/install | bash

Note: The -qO- is “O” as in output

NOTE: Wow!  It’s been a while since I did command line stuff.  Took me several tries, but: Needing a capital O; needed a hyphen after the O; needed one space after the O; needed me to not misspell Botspot.  Yeesh!  Great.  Now I have a Pi-Apps icon on desktop, and also within Menu, Accessories.

Installing Tor, using Pi-Apps:

-Menu, Accessories, Pi Apps

-Internet.  Browsers

-There is a ton, but I want “Tor”

-Install in bottom right of pop-up

-Some links in order to donate, which I’ll consider later

-Done.  Version installed was:

Running Tor, for the first time:

-Menu, Internet, Tor Browser Nightly

NOTE: It says in top-right that it’s not connected.  There is a selection for “Always connect automatically”.  An option to Configure Connection.  And, Connect button.

-For now, I left blank the “Always connect automatically”; didn’t change anything; and clicked Connect.

-Well…  It connected, so that’s good.

 

 

 

 

 

Posted in Raspberry Pi | Leave a comment

Nebula Raiders – Day2

Needing to load some libraries

Went to: https://craftingtable.com/pages/downloads

Needed lcd_api.py and i2c_lcd.py

Within Thonny:

-File, open and navigate to each file

-Open on computer

-Save As and save to Raspberry Pi Pico and name it the same. It then shows next to the first library I saved.

Wired it up and it worked. Now I have a 2 line LCD output device working

Task: Attach the LCD1602 display to the Raspberry Pi Pico using the I2C interface (SDA to GP0, SCL to GP1).

Code:

from machine import I2C, Pin
import utime
from lcd_api import LcdApi
from i2c_lcd import I2cLcd
 
I2C_ADDR = 0x27
I2C_NUM_ROWS = 2
I2C_NUM_COLS = 16
 
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
 
messages = [“Nebula Raider”, “Comm System OK”, “Incoming Msg”, “Awaiting Command”]
 
while True:
    for message in messages:
        lcd.clear()
        lcd.putstr(message)
        utime.sleep(3)

Q: What are lcd_api.py and i2c_lcd.py, which I needed to download from CraftingTable?  Libraries?

Q: What is an LCD1602 display? 

A: https://docs.sunfounder.com/projects/ultimate-sensor-kit/en/latest/components_basic/21-component_i2c_lcd1602.html (where I’ve used some of their documentation for my understanding).

A: It’s an LCD1602 IIC/I2C Blue Backlight Display, with 2 lines.    A 16×2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5×7 pixel matrix. The I2C module has a built-in PCF8574 I2C chip that converts I2C serial data to parallel data for the LCD display.

A: The PCF8574 device provides general-purpose remote I/O expansion for most microcontroller families by way of the I2C interface [serial clock (SCL), serial data (SDA)].

A: More detail:

An I2C LCD1602 consists of a normal LCD1602 and an I2C module that is attached to the back of the LCD. The I2C module is a chip that can expand the I/O ports of the Raspberry Pi using the I2C protocol. The I2C protocol is a serial communication protocol that uses two wires: SDA (serial data) and SCL (serial clock). The I2C protocol allows multiple devices to communicate with each other using only two wires and unique addresses.

The I2C module converts the signals from the Raspberry Pi into commands for the LCD. The LCD has 16×2 cells that can display characters or symbols. Each cell consists of 5×8 dots that can be turned on or off by applying voltage. The LCD can display different characters or symbols by turning on or off different combinations of dots.

Q: Why is the GP0 (SDA) port part of PIN1 on RPi?

Q: Why is the GP1 (SCL) port part of PIN2 on RPi?

Q: Why does the Python code have SDA=Pin0 and SCL Pin1, when the schematic is PIN1 and PIN2?

Q: What is VBUS on Raspberry Pi stand for.  I know it’s for power.  On the Display board it is labeled VCC

A: The VBUS port on the Raspberry Pi Pico W is the 5V power input from the USB port and is connected to the micro-USB connector. It can be used to power the Pico when it’s plugged in, and you can also use it to source 5V power to an external circuit. Important: Do not connect a second power supply to VBUS if the Pico is already powered via USB, as this can damage either power source.  When the Pico W is plugged into a USB power source, the VBUS pin receives that 5V, which is then used to power the board.  The amount of current available from VBUS depends on the power source. Powering external circuits: VBUS can be used as a 5V output to power external components or devices, but only when the Pico is connected to and powered by a USB sourceAlternative to USB: You can also connect an external 5V power supply directly to the VBUS pin (pin 40) instead of the USB port. However, you must not simultaneously connect another power supply to the USB port to avoid back-powering either source.

Pinouts and wiring:

Pin1: SDA (on back of display board) goes to PIN1 of Raspberry Pi.  Schematic is GPO and ‘I2CO SDA’

Pin2: SCL (on back of display board) goes to PIN2 of Raspberry Pi.  Schematic is GP1 and ‘I2CO SCL’

Pin23: GND (on back of display board) goes to PIN23 of Raspberry Pi.  Schematic is GND. 

Pin40: VCC (on back of display board) goes to PIN40 of Raspberry Pi.  Schematic is VBUS.  This must be Power. 

Examining the code, for understanding:

from machine import I2C, Pin
-Now we’re bringing in ability to both work with PINs on the Raspberry Pi board and also the I2C port location on the board
-The I2C (Inter-Integrated Circuit) is a bus that allows serial communication over two wires (using a communications protocol) for short-distance data communication
-In our scenario, I have a Raspberry Pi Pico WH and a LCD display device that displays 2 rows of 16 characters. 
 
import utime
-We saw this before, and allows us to interrupt the action, for example, to pause things
 
from lcd_api import LcdApi
 
from i2c_lcd import I2cLcd
 
I2C_ADDR = 0x27
I2C_NUM_ROWS = 2
I2C_NUM_COLS = 16
 
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
 
messages = [“Nebula Raider”, “Comm System OK”, “Incoming Msg”, “Awaiting Command”]
 
while True:
    for message in messages:
        lcd.clear()
        lcd.putstr(message)
        utime.sleep(3)
Posted in Uncategorized | Leave a comment

Nebula Raiders – Day1

 
from machine import Pin
import utime
 
led_green = Pin(15, Pin.OUT)
led_red = Pin(14, Pin.OUT)
led_blue = Pin(13, Pin.OUT)
 
while True:
    led_green.on()
    utime.sleep(1)
    led_green.off()
    led_red.on()
    utime.sleep(1)
    led_red.off()
    led_blue.on()
    utime.sleep(1)
    led_blue.off()

I was able to follow instructions, and got the python program to run.  Issue is that I have a logic flaw in how current is flowing, and specifically about positioning of resistor.  See below. 

Taking a deeper dive into understanding the Python Code:

Reference: (https://docs.micropython.org/en/latest/library/machine.html)
 
from machine import Pin
-Machine is the Raspberry Pi hardware which can return specific machine-level data
-The machine is considered a module and has various functions that can be passed to the program with hardware information.  Caution is advised, as it can get granular and can damage the hardware if done incorrectly.
-Getting acclimated to terminology but Pin is part of a class.  The pin object controls various pins of GPIO (general purpose input/output), which are pins I’ve seen on the board.  The flow can go either way, with PIN IN or PIN OUT
 
import utime
-While it appears that utime (specific to micropython) is part of the machine module, it’s not. 
-Utime is to do with time-related functions, such as delays and time intervals
 
led_green = Pin(15, Pin.OUT)
-led_green is a variable
-PIN is a function, sending a message OUT from the hardware, and has two parameters, including which pin and if it’s OUT or IN
-In this case, Pin 15 sends signal to the Green LED to turn on
 
led_red = Pin(14, Pin.OUT)
-In this case, Pin 14 sends signal to the red LED to turn on
 
led_blue = Pin(13, Pin.OUT)
-In this case, Pin 13 sends signal to the blue LED to turn on
 
while True:
-This creates an infinite loop, which requires manual intervention to stop
-There are several lines of code that go in sequence, and then loop back to the top again
 
    led_green.on()
-This turns the green LED on. 
-This also means sending a HIGH logic level to the pin (more energy/electricity); a high voltage state
-There are several ways of doing this: led_green.value(1) or led_green.value(true)
-In our scenario, there is a dedicated method of turning it on with: led_green.on()
 
    utime.sleep(1)
-This function, specific to MicroPython, will pause execution for 1 second
 
    led_green.off()
-Green LED turned off
 
    led_red.on()
-Red LED turned on
 
    utime.sleep(1)
-Pause execution for 1 second
 
-Rest of command are obvious:
    led_red.off()
    led_blue.on()
    utime.sleep(1)
    led_blue.off()
 
Understanding current flow and positioning of resistor in the schematic:
 
-Component of the LED is long led (Anode) and short leg (Cathode). 
-The schematic shows a flow from the Microcontroller Pin to the LED to the resistor to Ground. 
-I’m reading that the positioning of resistor (either before or after LED, doesn’t matter as long as everything is between Microcontroller Pin and Ground. 
-The consensus is that it doesn’t matter, but I need to read up again on: ohm’s law and kirchhoff’s laws
 
Posted in Uncategorized | Leave a comment