Week 5: Electronics design

Electronics Design

In this week the aim was to learn how to design electronics to do certain simple tasks. In the previous week, I was able to do some work on Fritzing, the electronics design software. During the first part of this weeks tutorial, I was asked to demonstrate how to use this software to the rest of the class. This involved me explaining how to  design  the  circuit  from  last  week. (See Week 4 Electronics Production for more information on using Fritzing and designing pcbs)group tutorialWe were also tasked with learning how to code using the BBC Microbits. These are Microcontrollers that are designed to be as accessible as possible to get people of all ages and abilities into coding: https://microbit.org/. The code to control the micro bit can be created and edited both on the online make-code editor, and the ios and android apps. You then sync this with the device either with Bluetooth or a micro usb cable.microbit homepage

The first thing I tried to do was to display  a smiley face on the 5×5 LED grid. I had a play with the input and basic tabs on the code editor and was fairly easily able to use the ‘show LED’ function to show a smiley face. I was curious about what the actual code looked like for this very simple excersize so i switched over to the python option just to see how it looked. Because this was fairly simple, I then added some degree of animation to it and used the show string block in the editor to display ‘hello’ on startup.

Next I had a look through the tutorials in the make code app. I spotted there was a compass tutorial and decided that that would be an interesting one to try. This was my first experience using the red ‘variable’ tab which allows you to set up variables that can change based on inputs. I created the variable heading and set it to equal the compass heading from the onboard compass. Then i had to determine how to display each point of the compass based on the heading. This was done, as can be seen below, with an ‘if’ bracket from the logic tab. You can the simulator tab to change the angle of the device and demo the code below.

Next I found this snap the dot tutorial that walks you through programming an easy game of reflexes with the device. I found this tutorial to be really helpful and was able to make the code using the blocks without any problems.

Once I had got the game working properly, I had a go at changing the speed (and therefore the difficulty of the game) I found this was really easy by just adjusting the pause (in the forever loop) so the sprite moved a little quicker. See below the code for this project.

Finally, I had a play with the radio function of the micro bit. I only had a single micro bit so I teamed up with Christy in the class. We then used the make-code editor to send a message to one another. At first this didn’t work because I didn’t realise that you needed to set the radio group. Once we had figured this out however, we were able to send any message via the radio link and have it display on the screen of the other persons device.
Print Friendly, PDF & Email