Tuesday, 8 April 2014

Back to Basics with the Raspberry Pi Wobbulator

The Raspberry Pi Wobbulator has evolved and now has many new features including X and Y scales and a continuoius sweep option. The latest version 2.7.1 is now available on GitHub and has been uploaded to the Yahoo group. For those potential users new to Linux and the Raspberry Pi I thought that it might be time to recap (and update) some of the setup instructions for the Raspberry Pi.

So, imagine you have just received your Raspberry Pi.You may or may not have received a preformatted SD(HC) card with it. If you have received a preformatted SD(HC) card with your Raspberry Pi, it  probably contains the NOOBS OS loader software which gives you a choice of operating systems - please follow the instructions here to load Raspbian (Debian Wheezy).

If you have not received a preformatted SD(HC) card with your Raspberry Pi (or you have and you don't want to use it), you'll need a blank SD(HC) card of at least 4GB capacity, like the one shown below (available from Cut Price Cables):


The first thing you have to do is to download and install the latest version of Raspbian (Debian Wheezy). Go to www.raspberrypi.org/downloads and download the .zip file to your computer - it is quite a large download (about 780 MB) and there are various mirror sites where you can download it from.

Once you have downloaded and extracted the .zip file you should have a .img file with a size of 2900000 KB (2.80 GB). This is the bootable image that you will write to your SD(HC) memory card.

In order to write the bootable .img file to your SD(HC) memory card you need to download Win32DiskImager (I'm assuming here that, like me, you are a Windows user). Extract the .zip file in the directory (folder) you want to run it from. You can create a shortcut for Win32DiskImager on your Windows desktop by right clicking on the Win32DiskImager.exe file and selecting "Send To Desktop".

Take your SD(HC) memory card - if it is brand new it should be ready formatted, but if you have previously used it in (for example) a digital camera you will need to format it in your digital camera first. If your computer has an inbuilt card reader/writer, insert the SD(HC) card into the card reader/writer slot. If your computer does not have an inbuilt card reader/writer then you will need a USB memory card reader/writer like the one shown below (available from Cut Price Cables). Insert the SD(HC) card into the USB memory card reader/writer and then connect the USB memory card reader/writer to a USB port on your computer.


Double click on the Win32DiskImager shortcut on your Windows desktop and then click on "Run" if you get a Security Warning dialogue. The Win32DiskImager window should now be open.


Your SD(HC) card should show up under "Device" at the top right of the Win32DiskImager window - in the above screen shot the SD(HC) memory card is shown as D:\, but you may need to click on the drop down list to select the correct device.

*** A word of warning - I have a Toshiba laptop with an inbuilt card reader/writer, but Win32DiskImager refuses to recognise a memory card inserted into the inbuilt card reader/writer - I don't know why! However it works fine with a USB memory card reader/writer...***

Now all you have to do is click on the small folder icon to the left of the "Device" drop down list and navigate to and select the .img file you want to copy to the SD(HC) memory card. Then click on "Write" and "Yes" when asked to confirm overwrite.

Writing the bootable image file to the SD(HC) memory card will take a few minutes. Once complete you should get a "Write successful" message - click "OK" and then click "Exit" to close the Win32DiskImager application. If you are using a USB memory card reader/writer you need to click on "Safely Remove Hardware" and then remove the USB device before removing the SD(HC) memory card.

You should now have a bootable SD(HC) memory card for your Raspberry Pi.

Connect your USB keyboard and mouse to the two USB ports on the Raspberry Pi. Connect the Raspberry Pi to a suitable display (TV or computer monitor) using an HDMI (or HDMI to DVI) cable. Insert the prepared SD(HC) memory card into the card slot on the underside of the Raspberry Pi. Finally insert the micro USB power connector (making sure that the power adapter is switched on at the mains outlet).

If all goes well the red PWR (Power) LED on the Raspberry Pi board should light up and the ACT (Card Activity) LED should flash green. You will see many lines of text scrolling up on your display - this is normal. After a short time you will be presented with the Raspi-config screen:



Select the "Expand Filesystem" command and press Enter. This will expand the root partition on the SD(HC) card to use all the available space - if you don't execute this command the root partition will not use all the available space on the SD(HC) card. When you execute the "Expand Filesystem" command you will see some text scroll up your display and then you should see a dialogue confirming that the root partition has been resized:



Press Enter to close this dialogue and return to the Raspi-config "home" screen. I would recommend that you don't select any of the other commands at this time - although the Raspi-config screen only appears the first time the Raspberry Pi is booted, it can be run again at any time from the command line (you'll see how to do this shortly). Use the right arrow key to move the cursor down until "Finish" is highlighted in red and then press Enter. You will see a dialogue asking you if you want to reboot now.


Press Enter again to reboot the Raspberry Pi. Again you will see a lot of lines of text scroll up your display but eventually after the Raspberry Pi has rebooted you will see the following:

raspberrypi login: _

Type "pi" and press Enter. Now you will see the following:

Password: _

Type "raspberry" and press Enter (note that this time as you type the letters will not appear on the screen - this is to protect the security of your password). You should see some text scroll up your display and then you should see the following prompt:

pi@raspberrypi ~ $ _

This is the Linux command line prompt. From here you can enter commands directly - for example you can run the Raspi-config application simply by typing "sudo raspi-config" as follows and pressing 
Enter:

pi@raspberrypi ~ $ sudo raspi-config_

Use the arrow keys to move down to the "Enable Boot to Desktop/Scratch" option and press Enter.


You will see a "Choose boot option" dialogue. Choose the option "Desktop Log in as user 'pi' at the graphical desktop" and and press Enter.



You will see some text appear on the screen and then you will be returned to the raspi-config main window:



Use the right arrow key to move the cursor down until "Finish" is highlighted in red and press Enter. You will see a dialogue asking you if you want to reboot now. Press Enter again to reboot the Raspberry Pi.

When your Raspberry Pi reboots it should go straight to the LXDE GUI desktop. Using this configuration should make the system more "user friendly" because there is no need to log in or type "startx" each time, but the command line prompt is still easily accessible via LXTerminal if you need it. It also makes shutting down your Raspberry Pi simpler because now, when you click on "Logout" you get the following options:


If you click on "Shutdown" the LXDE GUI will close and your Raspberry Pi will safely shut down so that the power can be safely disconnected.

If you click on "Reboot" the LXDE GUI will close and the Raspberry Pi will restart and reload the GUI.

If you click on "Logout" you will have the option to log in as a different user.

You can of course revert to booting to the Linux command line by running the Raspberry Pi configuration utility again (in LXTerminal), selecting the "Enable Boot to Desktop/Scratch" option, and then choosing the "Console Text console, requiring login (default)" option.

To connect your Raspberry Pi to a network, simply insert a ethernet (CAT 5E) cable (available from Cut Price Cables) into the ethernet socket next to the two USB ports. Provided the other end of the cable is connected to a local area network (via a router for example) your Raspberry Pi should automatically connect  to the network, and the FDX (Full Duplex) LED, LNK (Link) LED and 100 (100MBit) LED should all light up (green, green and yellow respectively). You can check what the IP address of your Raspberry Pi is on the network by opening a LXTerminal window and typing "ip address show" at the command line prompt and pressing Enter. This will give you the following information:


The IP address is the sequence of numbers following "inet", so in my case it is "192.168.1.104". You'll need this information if you want to access your Raspberry Pi from another computer on your network. However please note that this IP address may not always be the same each time you connect your Raspberry Pi to a network.

Now that your Raspberry Pi is connected to the outside world, the first thing to do is to download the most recent updates for your Raspbian (Debian Wheezy) operating system. To do this type "sudo apt-get dist-upgrade" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo apt-get dist-upgrade_

Your Raspberry Pi will now download and install the latest updates for your operating system. This may take a while. As it is progressing you will see a lot of text scrolling up your display screen.

The Raspbian (Debian Wheezy) operating system on your Raspberry Pi also gives you access to a huge library of (mostly free) software called the repository.  The "apt" part of the command you just entered stands for "Advanced Packaging Tool" and this is the management tool for the software repository. The operating system maintains a database file of all the software in the repository and you can download the latest version of this database by typing "sudo apt-get update" at the command line prompt and pressing Enter:

pi@raspberrypi ~ $ sudo apt-get update_

Your Raspberry Pi will now download and install the latest repository database files and will report it's progress by displaying various lines of text on your screen. When completed type "sudo apt-get upgrade" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo apt-get upgrade_

This will instruct your Raspberry Pi to download and install the latest updates for all the software installed on your system. This may be a large download and may take a while. Once again as it is progressing you will see a lot of text scrolling up your display screen.

The Raspbian (Debian Wheezy) operating system and all the software installed on your Rasperry Pi should now be up to date. It is a good idea to run all three of the above commands regularly to ensure that your system has all the latest updates.

The Raspberry Pi Wobbulator software was all written in Python 3, which seems to be the programming language of choice as far as the Raspberry Pi community is concerned, perhaps because it comes ready to use with the Raspbian (Debian Wheezy) operating system. The software was written using IDLE 3 (the Python 3 Integrated Development Environment supplied with  the Raspbian (Debian Wheezy) operating system). To launch IDLE 3, double click on the IDLE 3 shortcut on the LXDE desktop. This will open the "Python Shell" window as shown below.


From here you can enter commands directly for immediate execution, or you can open a Python file to work on, or create a new file by clicking on the "File" menu and choosing the appropriate action.


However, please note that the Raspberry Pi Wobbulator software must be run with "root" privileges or as “sudo”. One way to do this is to launch IDLE3 with root privileges by typing "sudo idle3" at the command line prompt in a LXTerminal window and pressing Enter (but you have to do this every time you want to launch IDLE3 with "root" privileges).

pi@raspberrypi ~ $ sudo idle3_

A more convenient way to ensure that IDLE3 is always launched with "root" privileges is to edit the IDLE3 shortcut. Double click on "LXTerminal" to open a terminal window, and then type "leafpad Desktop/idle3.desktop" and press Enter


This will open the file "idle3.desktop" in Leafpad (a simple text editor). Go to the line "Exec=/usr/bin/idle3" and insert "sudo " in front of "/usr/bin/idle3" as shown below (I've highlighted the required change to make it stand out).



Click on "File->Save" to save the file, and then click on "File->Quit" to close Leafpad. Now every time you launch IDLE3 by double clicking on the IDLE3 icon on your LXDE desktop, you will have root privileges.

Now you're ready to build your Raspberry Pi Wobbulator by following Part 1 and Part 2 of the construction guide, and then follow the instructions in the Part 1, Part 2, and Part 3 of the setup and testing guide to get your Raspberry Pi Wobbulator up and running.

Raspberry Pi Wobbulator PCBs, full kits, and DDS modules are available from Cut Price Cables with free worldwide shipping, and for all the latest developments and discussion please visit the Raspberry Pi Wobbulator Yahoo User Group.

2 comments:


  1. ان الرائد تقدم افضل الخدمات النزلية في المدينة المنورة بارخص الاسعار يمكنك زيارة التالي للمزيد من المعلومات :

    افضل شركة تنظيف منازل بالمدينة المنورة افضل شركة تنظيف منازل بالمدينة المنورة
    شركة مكافحة حشرات بالمدينة المنورة شركة مكافحة حشرات بالمدينة المنورة
    شركة تنظيف مجالس بالمدينة المنورة شركة تنظيف مجالس بالمدينة المنورة
    شركة تنظيف بالمدينة المنورة شركة تنظيف بالمدينة المنورة

    ReplyDelete