About Benn Thomsen

Lecturer in Electronic Engineering, UCL. Research: Optical comms, Distractions: Embedded Systems, IoT and inspiring the next generation of engineers.

OpenHAB2

To install on a Raspberry Pi follow the instructions here. Install the beta version using apt-get

To Install MQTT

Following the instructions here

wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key

sudo apt-key add mosquitto-repo.gpg.key

cd /etc/apt/sources.list.d/

sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list

sudo apt-get update

sudo apt-get install mosquitto

 

sudo apt-get install mosquitto mosquitto-clients python-mosquitto

To stop the MQTT server
sudo /etc/init.d/mosquitto stop
 

Graphical programming

Graphical programming is a great way to learn how to program. I remember using a programme called logo on a commodore 64 to produce works of line art using what is known as turtle graphics. The programme that you wrote was textual with only four simple commands pen_up, pen_down, rotate(angle), move(distance), and loops, but the output of your programmes was graphical and immediate.

I have recently come across an open source project called blockly that provides a graphical approach to programming as well.

You can check out a recreation of one of my early art pieces using the blockly turtle demo here.

Using Google Docs for Real-time Lecture Feedback

Instructions for setting up a series of questions that you can get students to respond to in real-time within a lecture on any internet enabled device.

Create a Google form with the question that you wish to ask.

Creating a Google form.

  1. Login to your Google drive
  2. Select Create and choose Form from the drop down menu
  3. Give the form a name and select a background theme (I like notepad)
  4. Give the form a descriptive title (This will appear on the form)
  5. Add help text to explain the type of response you are looking for.
  6. Choose the response type. e.g. Multiple choice, Text, Drop down list, checkbox etc…
  7. I like to have the responses stored into a Google Spreadsheet. To create the linked spreadsheet. Select Responses from the  menu bar and then Choose Response destination. If you wish to create a new spreadsheet then select Create

I use the Moodle lesson block to create the interface in which to present the questions to the students. This allows you to create a content page for each question and control the navigation from question to question.

  1. Create a new lesson activity.
  2. Add a content page
  3. Give the question a title
  4. Get the embed link from the Google Docs form: Select File>Embed and copy the link from the box that appears
  5. Now to include the embed link from Google Docs in the Moodle lesson. This needs to go into the page contents area, however, you need to edit the html directly to do this. First open the html editor by clicking the  Edit html Source button, then paste in the google iframe and select update.
  6. Sort out your navigation: Edit the content 1 description with the lable you would like to use for the navigation button. “Next” is usually sufficient for most purposes. Select the destination using the drop down box.
  7. Ignore everything else and hit save.
  8. Repeat steps 1-8 to add more questions.

Installing the Arduino Mega driver under Windows 8

You first need to enable the unsigned driver option in Windows.

1. Windows Key + R
2. Enter shutdown.exe /r /o /f /t 00
3. Click the “OK” button
4. System will restart to a “Choose an option” screen
5. Select “Troubleshoot” from “Choose an option” screen
6. Select “Advanced options” from “Troubleshoot” screen
7. Select “Windows Startup Settings” from “Advanced options” screen
8. Click “Restart” button
9. System will restart to “Advanced Boot Options” screen
10. Select “Disable Driver Signature Enforcement”
11. Once the system starts go to Arduino/Drivers folder and right click on the Arduino device you have and select install.

Polycom Soundstation 2W Computer connection cable

Polycom sell these and they come standard with the extended model. However if you have the base model, a standard stereo cable with 3.5mm plugs on each end and a soldering iron you can make your own. The base model comes with a 2.5mm stereo cable for connecting to a mobile phone, however most mobile phones in the UK have a 3.5mm jack so this is not of much use.

Cable assembly instructions

  1. Cut off one end of the 2.5mm cable. This cable contains three wires: red insulated wire is attached to the tip of the plug, the white insulated wire to the middle ring and the uninsulated wire to the base as shown in the figure below.
  2. Cut the 3.5mm cable in half. Again the cable should contain three wires, where typically, red insulated wire is attached to the tip of the plug, the white insulated wire to the middle ring and the uninsulated wire to the base. You can always check this with the continuity tester on a multimeter.
  3. The Soundstation 2W only has mono microphone output and sound input, so it is necessary to connect both the red and white wires together from the stereo output of the plug that you will plug into the PC headphone socket and similarly for the cable that you will plug into the PC microphone input. The required connections are shown in the figure below. If you plan to use heat shrink tube to cover the join don’t forget to slip this over the cable with the 2.5mm plug before you start to join the cables.
  4. Make sure you use some heat shrink tube or tape to insulate the speaker and microphone connections from each other
  5. Join all the uninsulated common wires together.
  6. Finally cover the join with heat shrink tube or tape.
  7. It is a good idea to mark the 3.5mm plug (the upper plug in the figure below) that is connected to the tip of the 2.5mm plug as the microphone plug (I put some heat shrink tube around the plug).

Image

To use the SoundStation 2W with Skype you first need to put the SoundStation into IP mode. Press Menu, select IP MODE, press OK, press ON, press SAVE.

Then plug the 3.5mm microphone plug into the microphone input jack of you PC (typically this is colour coded pink) and the speaker plug into the headphone output jack of you PC (typically this is colour coded green).

Now plug the 2.5mm plug into the computer jack on the SoundStation (this is next to the power plug). The LCD display on the SoundStation 2W should now say MOBILE PHONE IN.

Now open Skype. You may need to go to the Call menu >> Audio settings and make sure that the microphone input is set to the correct source, and the speaker output is set to headphones

 

Printing integers on the LCD display

To print a binary integer on the LCD display in as a string it is necessary to convert the binary integer into an array of ascii characters. The function itoa() which is in the stdlib.h library can be used to do this.

You first need to include the stdlib.h an define a character array to hold the coverted ascii string. This must be at least as long as the number of characters that you require.


#include <stdlib.h>

char buffer[5];             //Output of the itoa function

You need call the itoa() function as shown below where int_value is the number that you wish to convert and the final parameter is the base for conversion ( in this case 10 for conversion to a decimal string)


itoa(int_value, buffer, 10); //Convert the read value to an ascii string

The ascii string that is then in buffer can be written to the LCD display or sent over the USART to a terminal program.