Thursday, 7 September 2017

BBC micro:bit on Linux

In this tutorial we will be -
  • setting up the BBC micro:bit on Linux Lite 
  • using an online Python code editor
  • transferring the code to the micro bit and running it
                          Fig.1 BBC micro:bit rear view


For this tutorial you will need -
  • Linux Lite OS v3.2
  • BBC micro:bit
  • micro USB to USB cable
  • access to the internet 
First connect the micro USB in to your micro:bit, then connect the USB in to your computer. The micro:bit should flash an orange led on the rear, (rear side shown in Fig.1 above), and appear as a USB device would, this can take up to 20 seconds (but its usually faster), it should appear as shown in Fig.2 below.

                           Fig.2 BBC micro:bit in File Manager

If your BBC micro:bit is not recognized here is the Official Fault Finding Guide

In Fig.2 we can see the default files on the micro:bit.
The MICROBIT is highlighted under devices, right click this and choose unmount, then right click again and choose Eject.
Unplug your micro:bit from the USB port.

Fig.1 shows the rear of the micro:bit, where the orange LED flashes, turn it over so you see the buttons labeled A, and B, now plug it in to your USB port again and observe the LED grid and follow it's instructions -
  1. firstly you will see the words "Hello, World!" scroll across the grid
  2. next you will see a mix of animations
  3. next a Heart shape will appear
  4. after this you will get instructions to press the buttons A and B
  5. next you need to tilt your micro:bit and chase the LEDs as they light up on the grid 😊
This completes the first tests on the BBC micro:bit hardware, so you know it is working correctly before continuing.

In Fig.2 are shown 3 files, clicking the file named MICROBIT.HTM should open a web browser, this does not occur for me, it opens Leafpad instead.
As a workaround I instead open Firefox by clicking it's icon in the Panel.
Point Firefox to the BBC micro:bit Python Editor
as shown in Fig.3 below.

                           Fig.3 BBC micro:bit Python Editor

When you arrive at the Python editor the default text as shown in Fig.3 will be displayed.
  1. Down the left side you will see a column of numbers, these are the numbers for each line of code. Example Line 9 is highlighted.
  2. on Line 6, click your mouse just before World
  3. delete the word World, and type in your name, or a friends name
  4. on Line 7, click your mouse just before the word HEART, make sure you are to the right of the dot.
  5. delete the word HEART and type in the word HAPPY
  6. at the top left is a button called Download, click this and an image like Fig.4 below will appear.
                          Fig.4 Saving the file

Initially when pressing download your image will by default have "Open With" selected, change this by clicking the radio button below it, to the left of "Save File", as highlighted in blue in Fig.4, then click OK.

On your Desktop open your Home folder by clicking its icon in the Panel, click to open your Downloads Folder as shown in Fig.5 below.

                          Fig.5 showing Downloads folder highlighted

Inside your Downloads folder you will see a file named, microbit.hex
Right click this file and from the menu that appears select Copy, as shown in Fig.6 below.
 
                          Fig.6 Copy the microbit.hex file

Click on MICROBIT in the left pane of the window under the title of DEVICES.
You will see the image as shown in Fig.7 below.

                          Fig.7 Microbit files

  1. click inside the window on empty white space
  2. right click and select paste
  3. watch your micro:bit, it will now display Hello and your name and then a happy face instead of Hello World and a heart.
You have just edited your first code in Python, copied it to your device and seen the Output of the code changes you made 😊.

Should you wish to return your micro:bit back to scrolling Hello, World!, and displaying a Heart, edit lines 6 and 7 again, if you are unsure use Fig.3 above as your reference.

Tip -
If you get stuck reopen the Python editor and this will display the default code πŸ˜‰, download/save, and copy/paste this file to your micro:bit in the same way as above, to restore the default Output.

If you want to experiment with the other images that are built in, or read tutorials on how to make your own images there are info and tutorials here
 
The Micro:Bit Foundation main page is the hub for all things micro:bit.
You can also reach the Python editor from here by clicking "Let's Code", then scrolling to the Python section.

                          Fig.8 http://microbit.org


Below you can see the Prototyping System for the BBC micro:bit, that I use. It's an interesting kit and will allow you to do a wider range of projects and experiments.
You can also get the Prototyping System for the BBC micro:bit as part of the Inventor's Kit for the BBC micro:bit, the Inventor's kit includes some electronics components for specific projects, and is a good place to start if you do not have any components and are just beginning with electronics. The battery pack also enables you to take the above project out with you to show someone your message to them.
Additionally you can edit the code/message with an Android app, and send it to the micro:bit over bluetooth, whilst the micro:bit is powered up by the battery pack.

                          Fig.9 Prototyping System for the BBC micro:bit

I hope you enjoyed this post.

Credits:
Fig.1, and Fig.9 pics taken by Sammy.
Fig.3, and Fig.8 show screenshots from The Micro:Bit Foundation website.

Monday, 21 August 2017

Installing UFW on Raspberry Pi desktop

Here we will set up UFW (Uncomplicated Firewall) on a Raspberry Pi.
For this post I will be running Raspberry Pi Desktop in VirtualBox.
The process is the same on Raspberry 3, RPi Zero, and RPi Zero W.

1. open your Terminal by clicking on the icon highlighted in Fig.1 below.

                          Fig.1 Terminal icon highlighted

2. type into your terminal -

sudo apt-get update

To get the latest updated package info.

3. to install UFW type into your Terminal -

sudo apt-get install ufw

UFW is now installed but it is not switched on and running yet.

4. to switch it on we need to enable it, type into your Terminal -

sudo ufw enable

5. you can check that UFW is running by typing into your Terminal -

sudo ufw status

It should respond with -

Status Active

Tip -
If you run this check before enabling UFW it would have responded with -

Status Inactive

6. to see the default settings are enabled type into your Terminal

sudo ufw status verbose

It should respond with -

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing)
New profiles: skip

7. type into your Terminal -

exit

To close your terminal and return to your Raspberry Pi Desktop.

Tuesday, 15 August 2017

Panel Transparency, colours, and hiding

The Panel in Linux Lite, is similar to what is called the Taskbar in Windows, a narrow area at the bottom of the screen.
In some Distro's it can be located at the top of the screen, or on either side of the screen, sometimes called a Dash.
You can also make a second Panel, or more, if you wanted to.

Fig.1 below shows my current Desktop on Linux Lite 3.2.

                          Fig.1 Screenshot of my current Desktop

The image used for the wallpaper is available to download for none commercial use, on my G+ profile page in the Random Pics Collection, I didn't resize to a wallpaper, I simply selected the image and Linux Lite Desktop settings display the image as a wallpaper.😎

Panel Transparency

To change the panel's level of transparency you right click on the panel and a menu will appear like Fig.2 below.

                          Fig.2 right clicking on the panel

When the panel is right clicked move your cursor over the menu item named "Panel" shown highlighted in blue. A further menu will then appear to it's right, from this select "Panel Preferences" shown highlighted in Fig.2 above.

                                             Fig.3 Appearance tab

The Panel Preferences GUI will then open as shown in Fig.3 above.
Click on the tab named "Appearance" .
Dragging the Slider named "Alpha" until the number to it's right says 50 will produce a panel with the same Transparency level as in Fig.1
When finished editing click Close.

Tips -
  1. If you prefer a different colour with transparency, click the button to the right of the word "Color", which is below the Alpha slider, this will open the color picker GUI. 
  2. The colour can be changed using the colour picker, or by entering the Hex number in this GUI. 
  3. If you changed this to red for example, your panel would be red and have 50% transparency.
  4. The colour name in Fig.1 is #2B2E37 if you need to return to this after experimenting.
  5. If you are unsure of a Hex Color code, this page has some palettes and their Hex numbers. A Google search will also give you links to sites with colour palettes with their Hex number next to them, it can make changing colours quicker than using the picker tool, where you are deciding contrasts between the colours for your desktop.
  6. Moving the "Alpha" slider right will produce an increasingly solid, and less transparent colour.

Sizing the panel

If you click the "Display" tab, as shown in Fig.4 below, you can alter some other settings for the Panel.

                                            Fig.4 Display tab

I am using 1024x768 screen resolution on this computer and so the Panel looked quite chunky to begin with.
Using the Display tab in Panel Preferences it was possible to make even this resolution have a slimline Panel.
To do this look under the title of "Measurements" and move the slider for "Row Size (pixels)", to the left to make the Panel slimmer, and to the right to make it wider.
Shown in Fig.4 are the settings I use for the Desktop shown in Fig.1
When finished editing click Close.

Hiding the Panel

On the General tab, where you see "Automatically hide the Panel", click the drop down box to it's right, when "Always" is selected the Panel will not be visible, when you move your mouse cursor to the bottom of your screen the Panel will appear at the base of the screen.
When finished editing click Close.

Additional info and further reading

The # (hash) symbol is used to mean "number". The numbers are called Hex triplet, it is 6 digits made up of 3 Bytes.
You can learn more about Hex colours here

Hexadecimal is a numbering system, like denary (decimal) and Binary are.
Hex is also used for other things than defining colours.
You can read more about Hexadecimal here

Hex and Security

One other such use for Hex is in executable software, where a disassembler/assembler is used in combination with a Hex Editor, and a comparator.
The software is disassembled and the Hex edited, it is then reassembled, the comparator (A.K.A a Patcher), compares the modified software to the original unmodified software, and generates a Patch, of the changes made.
When a Patch is applied to the unmodified software on another computer by any end user it will change that software so it becomes the same as the modified version.
Patches can be created by a single person or a team, they are often then distributed online, or via updates, this enables the end users to apply that Patch and modify their software, without the end user needing to know anything about the above process, or how to do this, making it more user friendly.
This can be for improving security, to fix a bug, or update a software.
The process outline described above for legitimate use, can also be used illegally, those types of patches are termed "crg"(control release group), these are more commonly named "cracks", they are used to exploit the premium software security routines used by the copyright holders/owners, amongst other things.
I hope to have given a small insight in to exactly how these may present an unknown risk to security and safety online, as many modifications may be made for a wide range of purposes within one such patch.

Linux Patches

The Linux Kernel also has patches to improve it often, I have no idea how these are made, but they work in a similar way, in that when applied they change the end users system to that of the Patched system of the creator.
The difference being the Patch has been checked and signed off on by the community and official Linux kernel staff, at a variety of levels during the checking process.
Linux and the software used on it are mostly Open Source, the code is freely available, and end users are permitted to improve and modify it.

This in itself improves the security for Linux users compared to that of those using other OS's, where cracks are often used.


Tuesday, 8 August 2017

Adding and changing Wallpapers

Changing Default Wallpapers

To change one of the default wallpapers in Linux Lite right click the mouse on the desktop and select "Desktop Settings" see Fig.1 below.

                           Fig.1 Desktop Settings

This will display the GUI for the Desktop settings as shown below in Fig.2.

                          Fig.2 Desktop Settings GUI

To change to any of the default wallpapers left click 1 time on it's image in the Desktop Settings GUI, once you are happy with your choice click "Close" at the lower right of the GUI and you are finished.

Using one of your own pics as a wallpaper

Navigate to your pic location,  I chose to save my pic to the Pictures Folder, located at Home>Pictures.
Right click your pic and select "Set as Wallpaper", as shown in Fig.3 below.


                          Fig.3 Setting a pic as a wallpaper

Result shown below, with transparency added to the panel, (post on doing this soon).

                          Fig.4 own pic set as desktop wallpaper

If anyone likes my pic of a buff-tailed bumblebee on English Lavender taken in the garden at home, and wanted to use it, in any non commercial ways, you can download the image from my G+ profile page, link is top right of any of the blog pages, it is located in the Random Pics Collection.

As you can see in Fig.5 below when the Desktop Settings GUI is now opened the default wallpapers are not shown. Compare this to Fig.2 above.
The Pictures Folder is shown in its place.
This is fine if you only want to use your own wallpapers.

Tip -
Which ever folder you right click on an image to set it as a Wallpaper this will become the new folder in the Desktop Settings GUI.

                          Fig.5 Desktop Settings GUI using Pictures folder


Returning to the Default Wallpaper folder

Click the downwards arrow next to the Pictures folder as highlighted in Fig.6 below.

                           Fig.6 Highlighted arrow

This will will produce a menu, from this select Other, as shown in Fig.7 below.

                           Fig.7 Other highlighted

This will produce the window as shown below in Fig.8

                          Fig.8 Results of clicking Other

From this window click 1 time using left mouse button on "File System" and then
x2 left mouse clicks on the folder named usr, as highlighted in Fig.9 below.

                          Fig.9 usr folder highlighted

Inside the usr folder double click on the share folder, this will produce the results as shown in Fig.10 below, from these x2 left clicks on the "backgrounds" folder as highlighted.

                           Fig.10 backgrounds folder highlighted

This will produce 1 folder named "xfce", x2 left clicks on this folder will show the default wallpapers folder, as per Fig.11 below. Click the "Open button" shown highlighted, this will display the default wallpapers in the Desktop Settings GUI.

                           Fig.11 Open button highlighted

From the resulting Desktop Settings GUI click 1 time on any default wallpaper to set it as wallpaper, this will also change the Desktop Settings GUI back to the default, and the following time it is opened the default wallpapers will be displayed.

Tip -
If you do not select a default wallpaper, and clicked close, the next time you open the Desktop Settings GUI it will not have changed to the default wallpapers, it will still display your Pictures folder, or whichever folder you had used for your own wallpaper.

How to add your own wallpapers to the defaults folder

Locate your pic, right click it and select copy.

Open your home folder, and x1 left click on File System, then x2 left clicks on usr folder, as highlighted in Fig.12 below.

                          Fig.12 File Manager

Inside the usr folder x2 left clicks on the share folder as highlighted in Fig.13 below.

                           Fig.13 usr/share

Inside the "share" folder x2 left clicks on the "backgrounds" folder,  inside this is the single "xfce" folder, x2 left clicks on the "xfce" folder, you are now inside the default wallpaper folder.

Right click in the window in an empty white space, from the menu select "Open as Administrator", as shown in Fig.14 below.

                          Fig.14 Open as Administrator

You will need to enter your password, this will then open another window also showing the default wallpapers folder, you can see the difference as the version opened as Administrator has an orange warning bar on it, as shown in Fig.15 below.

                          Fig.15 Administrator window

Right click on empty white space in the Administrator window, and select paste, your pic will now appear in this window highlighted in blue, see Fig.16 below for an example of this.

                          Fig.16 added photo highlighted by default in blue

Click the X to close the Administrator window, then the X to close the File Manager window.

Right click your desktop and select Desktop Settings, as you can see in Fig.17 below,  your chosen photo will be displayed for you, in my case this is my bee photo. Clicking it with the left mouse button x1 will change the desktop wallpaper as with all the default wallpapers.

                          Fig.17 newly added pic to default wallpapers

Tip -
To remove your photo from the default wallpaper folder at any time, first change your wallpaper to something other than the one you wish to delete.
Follow the above steps to reach the Administrator window.
Right click on your photo you wish to delete, and select delete, close the Administrator window, and the File Manager window.

Friday, 28 July 2017

Micro SD Readers and OTG Shims

A simple time saving solution I use for Micro SD and USB sticks is to attach them to something so they are easy to grab when going out, and easy to locate in my bag.

 
                         Fig.1 who could forget this happy cat😊

                                               Fig.2 cat in action

On the happy cat is a woven loop, this comes with the chain as shown attached for hanging things on, it is actually for attaching the label of the cat. Near the woven loop is a fitting if you slide the ball of the chain to the centre you can open the chain.
Here I have attached a red Kingston flip USB stick, this is my Linux Lite Live USB.
The Champagne coloured USB stick is a Kingston data traveller, this is my current Linux Lite back up ISO, which is updated regularly.
The pink one is a SiyoTeam Micro SD card reader/writer, the SD card fits into it from the same end it pushes into the USB port, this means as you see it in Fig.2, it has a Micro SD inside it ready to use, with Noobs and set up for Debian Jessie pixel for Raspberry Pi 3, making it dual purpose for carrying a ready to use SD card, or a blank one, you also have the option to rewrite a card.
Another option would be to use a thread of your favourite colour, pattern or make a craft bracelet, whichever you choose it would need an opener, or need untying before use, so as not to stress the USB port with the weight of the happy cat and things hung on it, I based it upon the idea of a keyring.
You could use USB devices with opening rings but it makes them less secure, which is why I chose ones with solid rings on them.
I have this one, a blue one with tongue sticking out, and the black one with demonic eyes. They cost £0.99 each on eBay.
I also have a cute black and white cat, it has a nice rigid pink label on one side, with a paw print on it, this doesn't have a woven ring for attaching things, I do like to see it sitting on the component drawers at the moment, this one is a bean filled cat 😊. I might put a loop on it in the future.

                                  Fig.3 Micro SD readers/writers

These Micro SD readers are in the style of some Sandisk USB sticks, I thought they were kind of fun/quirky, they work very well, they cost £0.99 for 5 of them, or £1.15 for 10 of them, and are a low cost solution.

                                  Fig.4 SiyoTeam Micro SD card readers/writers

The SiyoTeam Micro Sd card readers/writers are the style where the Micro SD card fits inside at the same end that pushes into the usb port. They are a nice style and finish.
The Gold coloured one was £0.99, in a colour by random selling. The pink one I picked the colour from a seller having only pink it was £1.99

                                  Fig.5 OTG reversible shims


These OTG shims are fully reversible, they can be used to increase or decrease the port size, no tweaks are needed on these ones to use reversed. They cost £0.99 for 3 of them, they work really well and are a low cost solution.

All prices of items mentioned included free postage.

Saturday, 22 July 2017

Installing the Open Zone mouse cursor theme

The Linux Lite Manual  covers adding a mouse cursor theme under usual instances.

After browsing the cursor themes on xfce-look I chose a cursor theme I liked.
I then realized it needs a slightly different method to install it, which I managed to work out using the Manual and a little trial and error, shown in this post.

I liked the Open Zone theme initially for its Fire activity icons, after installing the theme I realized my dizzy moment πŸ˜• in that I often like to also use wallpapers that have orange, brown and similar colours and tones in them, after trying the other icons in the theme I realized the Open Zone Ice was ideal against these colour wallpapers.

For this tutorial we will be using Linux Lite 3.2, the latest release is 3.4 and available here.
The theme we will be installing is the Open Zone cursors available from xfce-look

                          Fig.1 xfce-look page for the Open Zone cursors
  1. clicking the tab highlighted at number 1 will show the file download link for the Open Zone cursors.
  2. clicking the link highlighted at number 2 will open the download for the cursors. As shown in Fig.2 below.
                          Fig.2 Firefox download manager

  1. ensure the "Save File" radio button is highlighted as in Fig.2 above.
  2. click OK, this will open the download window as shown in Fig.3 below.

                           Fig.3 Linux Lite downloads interface.

  1. check the highlighted location shown in Fig.3 above as "Downloads" folder, and that the cursor theme name highlighted above this is correct.
  2. click Save.                        
                        Fig.4 Linux Lite Home folder

  1. click the Home folder icon in your panel, or if you have your File Manager already open ensure it has your Home folder highlighted at number 1 in Fig.4.
  2. click the "Downloads" folder highlighted in Fig.4 as number 2.
                         Fig.5 Linux Lite Downloads Folder

  1. inside the downloads folder you will now see the downloaded archive for the Open Zone mouse cursors, highlighted as number 1 in Fig.5 above.
  2. right click this and from the menu select "extract here".
  3. this will extract the cursors from the archive, as highlighted below in Fig.6, number 1.
                          Fig.6 Extracted Cursor folders
  1. shown in Fig.6 the extracted folders are also all archives, that need extracting.
  2. right click them 1 at a time and select "extract here" from the menu. 
  3. Fig.6 shows the extracted folders for each archive at the top row and first 2 folders of the second row. Notice how these look like regular folders, when compared to the archives highlighted at number 1, the icons are different for the archives, and also have an arrow on each of them.
                          Fig.7 Deleting archives
  1. once you have extracted each archive it is okay to delete them.
  2. hold down the left mouse key and drag over the archives.
  3. right click any of the blue highlighted archives and select "Move to Trash" from the menu.
Alternative method of highlighting files
  1. this is useful where the files are not in a single group, or have other files between them that you do not wish to delete.
  2. hold down the Ctrl (control) key, and left click the mouse once, on each file you wish to select, only releasing the Ctrl key once all the files you wish to select are selected.
  3. right click any of the selected files highlighted in blue and select "Move to Trash" from the menu. This will move all selected files to the trash.
                           Fig.8 Extracted cursor folders

  1. shown in Fig.8 we can see the Open Zone folder now contains only the extracted files we will need.
  2. click the back arrow, at top left of the window below the word file, this will return you to the Downloads folder, as shown in Fig.9 below.
                         Fig.9 Moving the cursor parent folder
  1. right click the Open Zone folder and select "Cut" from the menu.
  2. click your Home folder from the left menu below the title "Places", in Fig.9 mine is named bitsnpcs, yours will be named with your username.
                         Fig.10 .icons folder
  1. once in your Home folder, it will be highlighted in blue as in Fig.10 above.
  2. hold down the Ctrl (control) key and press h (Ctrl+h), this will display the hidden folders in your home folder, as shown in Fig.10.
  3. look for the folder named .icons highlighted in Fig.10 number 1.
  4. if you do not have a folder named .icons after doing step #2 above you will need to create one by, right clicking anywhere in the empty white space and selecting create folder, name the folder .icons.
  5. double left click the folder named .icons
  6. right click anywhere in the white space and select "Paste".
                         Fig.11 Fully installed cursors

  1. your .icons folder should now contain the cursor folders and files, as in Fig.11 above. 
  2. click the X, at top right of the window to close the File Manager.
Tip
The next time you open your Home folder the hidden folders will still be visible, to hide them again hold down Ctrl (control) and press h (Ctrl+h).

                                 Fig.12 Mouse and Touchpad
  1. select Menu>Settings>Mouse and Touchpad, Fig.12 above.
                               Fig.13 Configuring your chosen cursors
  1. select the "Theme" tab as shown in Fig.13.
  2. you can click any of the Themes in the left pane, and a preview of them will appear in the right Pane.  Shown in Fig.13 I have selected OpenZone Ice Slim in the left pane and they are previewed in the right pane.
  3. once you are happy with your selection click Close and you will now be using your new mouse theme.

Wednesday, 5 July 2017

Poll Results - Which development boards do you use ?

Thank you to everyone who voted in the poll 😊
The results are in a pie chart chart below.



After next years poll on development boards I will make a pie chart for 2018, and I will also make a comparison graph too.

Chart made using Mathway, Firefox browser, and GNU Image Manipulation Program, on Linux Lite 3.2