I really hate having to double click on icons or programs to get them to open. This lesson is a quick one, but explains how to get your Raspberry Pi to open files, folders and programs with a single click of the mouse. To do this boot the Pi in the Graphical Interface. Then click on the file cabinet icon to get a folder to open. Then under Edit select Preferences. Then check the box that says “Open Files with Single Click”. Done!
Raspberry Pi LESSON 35: Install a Free Office Like Product on Raspberry Pi
Now that we are booting in the Graphical User Interface on the Raspberry Pi, we can explore some useful applications that will run on the Pi. LibreOffice is a free product that will do many of the things Microsoft Office does. This is a great addition to your Raspberry Pi. You can install this product by going to the terminal window, and at the command prompt on your Raspberry Pi type:
$ sudo apt-get install libreoffice
Now the new software should show up under your menu button. The video above steps you through some of the cool features of the product.
Raspberry Pi LESSON 33: Booting to the Graphical User Interface
If you have been following along in these lessons, we have been operating from the terminal window and the Linux command line. You have learned that you can simply and efficiently do whatever you want from the terminal window. Raspberry Pi does, however have a graphical interface. In this tutorial we show you how to boot in the graphical interface, and then how to find your way around.
Raspberry Pi LESSON 32: Options for Analog Input on the Raspberry Pi
At this point we have learned how to write digital values to the GPIO pins, we have learned to simulate analog out using PWM, and we have learned how to do digital reads from the pins. If you are like me and came from the Arduino world, then you will likely be asking, “Now what about analog reads”. The arduino has pins A0-A5 that make quick and easy work of reading analog values from things like photometers, sensors and various other circuit elements.
The bottom line is, unfortunately, there are no analogous capabilities on the Raspberry Pi. There is no way to directly read analog voltages.
Some suggest incorporating various analog to digital converter chips into your circuits requiring analog reads. For me, my preferred solution is the simply add an Arduino to the Raspberry Pi circuit. There are many very small form factor versions of the Arduino. For example, the nano is very small, and there are some examples that are even smaller. Some of these small implementations can be found for under $10.
If you take this approach, then all you have to do is learn how to communicate between the Raspberry Pi and Arduino either over USB or over ethernet. I show you how to do both of these things in the Lesson series on this WEB site “Using Python with Arduino”. This shows how to communicate between python and arduino using the USB, using Ethernet, or using the Xbee radios. Since python runs on the Raspberry Pi, all the techniques taught in those lessons can be applied to the raspberry pi.
In our high altitude balloon instrumentation package, we actually run a raspberry pi that is controlling two arduino nano microcontrollers. The one arduino is controlling the 9-axis IMU, and the other arduino is running GPS, Temperature, Pressure, and other sensors. The raspberry pi and Arduinos communicate over a small onboard Ethernet switch. The system communicates back to the ground via 1 watt ubiquity bullet radios.
So, the Raspberry Pi should not be viewed as a replacement for the Arduino, it should be viewed as a complementary device that can work nicely alongside the Arduino.
Raspberry Pi LESSON 31: Making a Dimable LED with Python
In this lesson we are ready to bring together a lot of what we learned in earlier lessons. We will create dimable LEDs which will respond to two buttons. If one is pressed the LED will gradually grow dimmer. If the other is pressed, the LED will gradually grow brighter. This will require us to use our skills in using GPIO inputs, pullup resistors, GPIO outputs, and PWM.
For convenience we will use the same circuit we used in LESSON 30, shown below. Also, if you want to follow along with these lessons, you can buy the gear you need HERE.
The objective of this circuit is that we want the LEDs to grow brighter each time the right button is pushed, and we want them to grow dimmer each time to left button is pushed.
The video above steps through and explains this code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | from time import sleep # Library will let us put in delays import RPi.GPIO as GPIO # Import the RPi Library for GPIO pin control GPIO.setmode(GPIO.BOARD)# We want to use the physical pin number scheme button1=16 # Give intuitive names to our pins button2=12 LED1=22 LED2=18 GPIO.setup(button1,GPIO.IN,pull_up_down=GPIO.PUD_UP) # Button 1 is an input, and activate pullup resisrot GPIO.setup(button2,GPIO.IN,pull_up_down=GPIO.PUD_UP) # Button 2 is an input, and activate pullup resistor GPIO.setup(LED1,GPIO.OUT) # LED1 will be an output pin GPIO.setup(LED2,GPIO.OUT) # LED2 will be an output pin pwm1=GPIO.PWM(LED1,1000) # We need to activate PWM on LED1 so we can dim, use 1000 Hz pwm2=GPIO.PWM(LED2,1000) # We need to activate PWM on LED2 so we can dim, use 1000 Hz pwm1.start(0) # Start PWM at 0% duty cycle (off) pwm2.start(0) # Start PWM at 0% duty cycle (off) bright=1 # Set initial brightness to 1% while(1): # Loop Forever if GPIO.input(button1)==0: #If left button is pressed print "Button 1 was Pressed" # Notify User bright=bright/2. # Set brightness to half pwm1.ChangeDutyCycle(bright) # Apply new brightness pwm2.ChangeDutyCycle(bright) # Apply new brightness sleep(.25) # Briefly Pause print "New Brightness is: ",bright # Notify User of Brightness if GPIO.input(button2)==0: # If button 2 is pressed print "Button 2 was Pressed" # Notify User bright=bright*2 # Double Brightness if bright>100: # Keep Brightness at or below 100% bright=100 print "You are at Full Bright" pwm1.ChangeDutyCycle(bright) # Apply new brightness pwm2.ChangeDutyCycle(bright) # Apply new brightness sleep(.25) # Pause print "New Brightness is: ",bright #Notify User of Brightness |