This blog/site is primarily to support the courses that I teach in digital design in particular embedded digital systems design using C and the Arduino MEGA hardware. I decided to post the course materials and code snippets here because:
a) Much of the knowledge, techniques and tools, that are used by real practitioners of embedded design, are freely available on the web and I have made extensive use of these in putting this material together. In publishing this blog I hope to also contribute to this community.
b) WordPress natively supports syntax highlighting of code snippets using the [sourcecode language=”css”] your code here [/sourcecode]tags and makes even the work of an electronic engineer look beautiful.
I had some feedback on the blog that said it wasn’t so obvious how to copy the code snippets for pasting into your own designs. So here is some guidance
If you float the mouse over the code snippet below then you will see a pop up appear in the upper right hand corner with four icons in it. If you select the copy icon the code snippet will be copied to the clipboard. The copy icon is the one that looks like two pages.
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.
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.
Login to your Google drive
Select Create and choose Form from the drop down menu
Give the form a name and select a background theme (I like notepad)
Give the form a descriptive title (This will appear on the form)
Add help text to explain the type of response you are looking for.
Choose the response type. e.g. Multiple choice, Text, Drop down list, checkbox etc…
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.
Create a new lesson activity.
Add a content page
Give the question a title
Get the embed link from the Google Docs form: Select File>Embed and copy the link from the box that appears
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.
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.
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 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
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.
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.
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.
Make sure you use some heat shrink tube or tape to insulate the speaker and microphone connections from each other
Join all the uninsulated common wires together.
Finally cover the join with heat shrink tube or tape.
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).
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
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.
char buffer; //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.