Week 7 – Display model – Josh Milkins & Richard Channing

This week our aim was to get our prototype to a point where it could be displayed while showing off its functionality.

We wanted to keep it simple so that it could display the different types of lighting found in the Warwick arms. We purchased a simple desk lamp and some smaller LED lights representing the ceiling lights and ambient wall lighting respectively.

PROTOYPE 3

No lights on

Main & Wall On

Main and wall lights on

Main On

Main light on, wall lights off

Wall On

Main light off, wall lights on

 

Only 2 of the relays are in use for the model, representing section one, but the code will still work for sections two, three and four but the only visual feedback is an audible click and an illuminated LED from the respective relay.

The first relay switches the main light with the command “alexa, turn on section one main lights”

The second relay switches the wall lights with the command “alexa, turn on section one main lights.

The remaining relays can be activated using the command “alexa, turn on section (2, 3 or 4) (main/wall) lights”

 

The Node MCU, Relay module and amazon echo are positioned to the side of the model to show how it works as well as enabling the user to see the relays actuate when commands are given.

Week 4 – Controlling a Single Device – Josh Milkins & Richard Channing

During this week we use the NodeMcu Lua V3 wifi enabled micro controller unit which was discussed in the week 2 blog post and integrate an Amazon Alexa to turn on and off an LED. We wanted to do this as we believe it is the first step into being able to control lighting through the IOT.

Below is a fritzing of the circuit:

First fritz

Using this we then went and wired it up. Here is a picture and video of the result:

IMG_20180326_142744

We powered Alexa using the USB power supply from our laptop while the wifi module and Led were powered from a separate computer. Below is a link to the code for this set up:

https://create.arduino.cc/editor/RJChanning/23de7abd-b1c7-436d-afc1-2dfc7131655e

An issue we did face was that the NodeMcu Lua V3 wifi module board proved somewhat unreliable however we feel like this is due to the breakout board as the Esp8266 module itself is the industry standard for wifi enabled MCU’s.

 

 

(Bob and Richard) The Smiling Matrix: MAX7219 LED Dot Matrix

Hi, welcome to the first week of our group project.

This week I am researching the MAX7219 LED Dot Matrix shown below.

MAX7219 LED Dot Matrix

It is a small serial input display driver that uses microprocessors to control the 8×8 LED display and It operates off of 5v. It can power up to 64 individual LEDs over up to 7 cascaded (linked together) arrays.

The datasheet for the MAX7219 serial interface can be found here:

Link to the MAX7219 datasheet

 

Getting the MAX7219 Array Working:

To get the LED array working a library for the MAX7219 was used (GitHub Manual for LedControl Library). This enabled easy-use of the MAX7219 chip.

The functions we used to get the library working were:

LedControl(DATA-IN pin, CLK-pin, CS-pin, number of arrays) – This is to define our array object, listing the pin connections and the number of arrays that are cascaded

shutdown(array number, true/false) – This is used to switch on the matrix, since it is initially set to off.

clearDisplay(array number) – Used to wipe the data on the array

setRow(array number, array row, byte) – Used to set a whole row of LEDs at once, this was used to draw the faces

setLed(array number, array row, true/false) – Used to set individual LEDs, this was used in the scrolling light code.

Initially we just wanted to understand how to switch on and off LEDs so I tried making an LED scroll across the screen. To do so we used the following code:

Link to Our ArduinoCreate Code

Using a for loop between i = 0 and 7, we could set the array to colour the LED in column i. After this the LED before it had to be switch off, which was simple enough using i – 1. The only complex part was where the LED was 0 or 7. When it was 0, we didn’t need to switch of the LED before. If it was 7 we set a delay, then switched of the 8th LED.

A video of our first test:

 

Making our Matrix Smile 🙂

To make our matrix smile we needed to explore arrays of bytes. A byte is a binary number made from 8 bits (1s and 0s), which has a maximum value of 255: 11111111.

An array is simply a list of variables. In our case bytes. To create our face we needed two arrays, each of 8 bytes; one for the frowning face, one for the smiling face.

We could have figured out the bytes manually, however instead we used this online tool which creates the array for me:  Byte Array Sketching Tool. All we had to do was draw on our smile and copy and paste the list of bytes over.

Our code for the smile Matrix is here: Code for the smiling matrix

Creating the images was fairly simple. Using a for loop like before we could get the row (0-7) from the pre-defined global variables. Then going through from i=0 to i=7 we got the byte for that row and wrote it to the MAX7219 using setRow().

Using a simple button circuit which we read from pin 6, we could get user input to make the matrix smile. In our final design we’ll use the IR sensor as the input signal.

 

Next Week:

Next week we’re creating our smiley face tip jar to encourage customers to tip.

Preview Sketch:

Basic concept001.jpg

SRD-05VDC-SL-C Relay research

Hi!

My name is Richard Channing. I am a student at UWE studying Product Design technology.

In this Blog I will be sharing with you my assignment for my physical computing module, this module is very exciting as it is based around learning how to use and program with Arduino.

For this project I have been given this:

SRD-05VDC-SL-C RELAY
Relay Sensor

It is a SRD-05VDC-SL-C Relay,

The datasheet for the songle relay is here – http://elecfreaks.com/estore/download/EF03052-SRD(T73).pdf

Now what is a relay?

“A relay is an electrically operated switch of mains voltage.” [1] It uses electromagnetism in a way that allows you to control a circuit using 5v from an Arduino and on the other end of this circuit control up to a 240V appliance.

How does it do this?

By using electromagnetism when the relay coil is energised it begins to act like a magnet and changes the position of a switch. The circuit which energises the coil is completely isolated from the part which switches on and off (as this is done using a magnet) providing what is called “Electrical isolation” Due to this you can use a relay using 5 volts from an Arduino and on the other end of the circuit be powering an appliance from the mains as the two circuits will be isolated from each other.[3]

The relay has 3 main pins these are:

COM – Common pin this is usually connected to ground

NO – Normally open pin this has no contact between the COM and itself normally until activation.

NC – Normally closed this pin is normally connected to the COM pin. [2]

 

My plan with this project is to use the relay as a switch so that i might power an apply that requires a higher voltage through electrical isolation. Below is an image of how to connect a 4 relay module to an arduino:

4 relay fritz[3]

References

[1]

“Guide for Relay Module with Arduino,” Random Nerd Tutorials, [Online]. Available: https://randomnerdtutorials.com/guide-for-relay-module-with-arduino/.

[2]

S. Kian, “Identify Terminal Pins of A Relay Without Reference to Datasheet,” 01 Aug 2012. [Online]. Available: https://tutorial.cytron.io/2012/08/01/identify-terminal-pins-of-a-relay-without-reference-to-datasheet-2/.

[3]

Hobbyist, “Step 2: Interfacing the relay modules to the Arduino,” Hobbyist.co, [Online]. Available: http://www.hobbyist.co.nz/?q=interfacing-relay-modules-to-arduino.