KenYEAH! 2k15


1 week Microcontroller Lab at Oxford University

You are viewing an older revision! See the latest version

Human Machine Interface and Screen

/media/uploads/ree5yd/img-20150612-wa0002-1-.jpg

/media/uploads/ree5yd/img-20150612-wa0006-1-.jpg

This module consists of two mbeds, linked by a Serial UART. The mbed with the screen is named 'Screen', and the other mbed (connected to the RFID reader) is 'Slave'.

Design Brief

The Screen must display:

  • When the door is Unlocked
  • Which locker to go to
  • How much charging time is left
  • The name associated with the RFID (or just the tag number)
  • The weather data from the weather module, upon request.

The Slave needs to:

  • Read the RFID tag number if a tag is swiped, and pass it to the Screen.
  • Possibly act as a data slave, using it's serial connetions to connect to the weather station.
  • Pass the data to the Screen, when the Screen is not busy.
  • Develop a method to control access to a locker using the RFID reader

Current Function

RFID reader

  • Reads an RFID tag and stores as a character array.
  • Sends RFID to the screen mbed using the serial UART, character by character, to fill another character array,

Wireless Reciver

  • Recieves the Weather Data (intermittent)
  • Passes to the screen mbed using the same serial UART method as the RFID reader

Locker flags

  • Sends a pulse to the locker when an RFID is present - telling the locker to unlock.
  • Receive a level from the locker when the locker is unlocked (so we can display to the screen).
  • Sends a pulse to the locker when RFID is presented a second time - telling the locker to lock.

Display

  • Continually checks for information at the serial port
  • Different start characters let the program know what data is being sent
  • Corresponding capitalised characters signify the end of transmission of this piece of data
  • Can display weather data
  • Screen formatted to display weather data in the lower half, complete with visuals for the light intensity and the temperature.
  • Screen formatted .

Future Plans

  • Configure the LCD's SD card reader to hold a file of RFID tag numbers, their owners, and their current charge credit (time left).
  • Format the screen readings into a more pleasing layout (especially weather)
  • Be able to store large amounts of data from the battery

What we did

Screen Setup

Our first task was to set up the screen on to the first mbed. We had to unsolder the headers and then re-solder them onto the other side of the board in order to enable the screen to fit corectly on top, and into the correct pins. Once the screen was connected to the mbed, we then used a standard library to initialise, and write to the screen. This library also enabled us to draw basic shapes and use a wide variety of colours.

RFID Reader

Our second task was to set the RFID reader up. The reason we needed a second mbed here was because the screen took up all but one of the serial ports. We therefore needed to use a second mbed to be connected in serial to both the Locker team and the Weather Data team, as well as the RFID reader, which took up a third serial port. We first connected the RFID reader to the second mbed, and checked it was recieveing data using the pc terminal. The RFID library made things relatively straightforward here. Next, we had to send the data to the Screen mbed, using the serial connection, as shown below:

This was the hardest part of our module, and we spent the best part of a day trying to figure out the right method to put data on the serial bus, and to take it off again. Initially we used 'printf' and 'scanf' to write whole strings at a time. This worked to some extend, but timing issues between the two mbed which we couldn't fully synchonise led to problms transmitting the whole data intact. We then decided on using 'putc' and 'getc' to only place single characters at a time on the bus, with an imposed delay between each character. This was much more reliable, and did not result in a noticeable loss of speed, so this was the method we implemented.

Interfacing to the Locker

We also had to pass a set of flags between our mbeds and the Locker to tell them when someone had swiped, and when to open the door. This was achieved simply using two pins, one DigitalOut to tell them to unlock the locker, and one DigitalIn to inform us that the door was then closed again. This was the simplest form of communication between all our seperate modules.

Below is an image of the pair of wires (green and yellow) connecting us to the Locker team

/media/uploads/ree5yd/img-20150612-wa0003-1-.jpg

Wireless Transfer of Data from the Weather team

Our final tasks were to set up communications with the Weather team, who were recording atmospheric information such as humidity remperature and pressure. We adopted a message convention where each piece of data, just a 'float' number, was surrouned by a set of identifiers so that we could tell what data we were recieving. For example, if the data was a temperature, the complete string we would be sent was : 't24.012T', the lower case signifying start of temperature, Upper Case indicating the end. If instead, the data sent was an RFID tag , it would be surrounded with 'a' and 'A'.

As we've mentioned above, the screen mbed had no free serial ports, so we connected both the RFID reader and the wireless reciever to the Slave mbed. This Mbed then simply took the data it recieved and passed it to the screen. We were beggining to run out of time, so we first disabled the RFID reader, and then concentrated on recieving the weather data correctly. We were able to get it to function intermittantly, with the screen sometimes displaying the correct values, and other times displaying only zeroes. We assumed this was a problem with the reciever not placing the data on the Serial bus to the Screen mbed correctly every time, but we were unable to refine it to function perfectly.

We also include below a previous revision of the code for the Slave, before the Wireless Reciever was added, which has the RFID reader enabled. This will take the Tag Number when an RFID tag is swiped, and pass it to the screen. The screen then compares this number to a database (currently only held in the flash memory or the mbed) to asscertain the identidy of the person associated with the Tag Number ( in our case, one name called 'Lew', another called 'Tom', associated with two different tag numbers).

Import programreceiver

test receiver for weather peeps

Import programsender

This is the code for the mbed which receives the weather data, pushes serially to screen

Import programsenderRFID

sends the RFID tag number serially to screen

Video of Swiping to Recognise People

Further Pictures of the system

/media/uploads/ree5yd/img-20150612-wa0007-1-.jpg /media/uploads/ree5yd/img-20150612-wa0008-1-.jpg

/media/uploads/ree5yd/img-20150612-wa0004-1-.jpg /media/uploads/ree5yd/img-20150612-wa0005-1-.jpg


All wikipages