Training, Notting Hill Gate, day 2

So day two at Notting Hill Gate, happy with having a play around with the microbits I moved my attention to something a little further up the food chain, the still usable, but potentially more involved, Arduino platform. I bought an Uno board ages ago and played around for a few minutes here and there, but never actually got around to connecting anything to it, even only simple things, so once again this was a good time to just hook up some simple stuff, and see what is and isn’t doable…

Adding basic devices to Arduino

Aim

Testbed for use of Arduino IDE, hook up of simple devices to facilitate rapid development of more focused and useful applications – knowledge formative exercise adding each device one at a time, establish method for mode of operation for each device, and understand code  with view to merging code and devices at once, to build full scale applications using the array of I/O of an Uno board.

BOM

Arduino Uno, HD44780 Compliant LCD, RC522 NFC Card reader

Setup

Stage 1 – LCD device, attach the LCD to the Uno development board as follows:

LCD RS to Digital 12

LCD Enable to Digital 11

LCD D4 to Digital 5

LCD D5 to Digital 4

LCD D6 to Digital 3

LCD D7 to Digital 2

LCD R/W to GND

LCD Pin 3 to GND (Contrast)

Copy test code into Arduino device:

// Bring in the required library for driving LCD displays
#include <LiquidCrystal.h>


// LCD pin setup, see LCD example documentation for further details
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


void setup() {
  // Sets X Y configuration of LCD connected
  lcd.begin(16, 2);

  // Display something on the LCD.
  lcd.print("hello, world!");
}


void loop() {
  // Running code for main loop here...
}

Use

Demonstrates how simple the LCD is to set up, and puts basic characters onto the screen, useful for serial debug etc. Remove wiring and LCD for stage 2.

Setup

Stage 2 – Reading with an RC522 NFC reader and dumping the output to the IDE serial monitor. Attach the RC522 in the following fashion:

RST to Digital 9

SDA to Digital 10

MOSI to Digital 11

MISO to Digital 12

SCK to Digital 13

3.3V to 3.3V

GND to GND

Copy test code into Arduino device:

// Bring in necessary libraries for the reader and interfaces
#include <SPI.h>
#include <MFRC522.h>


// Start an instance of the reader
MFRC522 mfrc522(10, 9);

void setup() {
Serial.begin(9600);
while (!Serial);
SPI.begin();
mfrc522.PCD_Init();
mfrc522.PCD_DumpVersionToSerial();
Serial.println(F("Scan card to see all available details..."));
}


void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}

if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}

mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

Use

Present card to RC522, contents of device are presented on the IDE serial monitor screen as a verbose dump. Most useful value arguably card serial, ideal for use as identity device as serial is read only block. Demonstrates simple extraction of data from NFC.

Further Development

Combining both sets of code to give output on LCD display, or message customized to the card.

Another good day of tinkering with simple stuff, but good stuff that can be combined to make BETTER stuff… Day three, is the first day of our group project.

Training, Notting Hill Gate, day 1

The week of the 11th of December 2017, I met up at Notting Hill Gate with some other engineers from my team, Paul, Hannah, Ash and Charlie, for us to embark on some joint training, what follows is a few blogs on how those four days of training panned out!

So working as a Lab engineer is a mixed role, we’re multi-discipline, people can come to us with all kinds of projects, that can need all kinds of skills. I’m pretty handy with a 3D printer and a laser cutter and some CAD software, but getting the time to play around with electronics is a rare luxury, so when we were told we’d be getting a week at our Notting Hill Gate lab with FabLab’s, the curriculum sounded like an ace opportunity to get some tinker time…

The first day was personal project day, giving yourself the time to just learn about something of interest that you wouldn’t normally have time for. Working out what to do was as simple as rummaging through some huge crates filled with all manner of goodies, from drones, to arduino boards, microbits, littlebits, you name it.

Being a big fan of the microbit, and an avid believer that they are hugely under-rated for electronic development, I decided to have a play around with a pair of microbit devices, as I wanted to use the internal radio function: It was something I’d been meaning to do for ages. Each day, we had to write up our activity, so, here is my little brain dump from day one…

Simple dual Axis spirit level with remote view via radio

Aim

Demonstrate simple use of internal inclination sensor and radio transmission and reception.

BOM

2x Microbit, 2x Battery Pack

Setup

Copy master code to one Microbit, slave code to the other. Power up both microbits, M will be displayed on the Master, S will be displayed on the Slave.

Use

Master is the remote display, position it in an easily visible location. Slave is the inclination detection device, place it on the surface to measure, hold it steady and press button A to show the pitch on the display and send the Pitch (Y) to the master for remote viewing, or press B to do the same for Roll. (X)

Further development

Real-time display on master using a “Chasing-dot” format to show roll and pitch on the slave, real-time output on serial port.

A very simple but enjoyable first day, nice to see the Microbit Radio in action, and see just how easy it is to use, makes the Microbit very handy for a number of projects… Watch this space!