Multiple sensor/display project

Hey Forum,
I have a very newbish question.

First, some background: my last project was 15 years ago on an ATMEL microprocessor (if I remember well) using C and VSDL.
It simply drove pushbuttons and light-emitting diodes. So mark me "noob".

Then, my objective: I want to have a box standing at the entrance of the office, that the coworkers could beep their railcard (NFC card) on.
The box would display "HELLO NAME TIME", or "BYE NAME TIME", and blink a multicolour diode (green:"OK", red: "Fault", yellow:"Processing").

The hardware: Arduino Uno for prototyping, and two Arduino Mini for execution.
The sensor/displays:

  • RFID card (RC522)
  • display (the one that comes with the start box)
  • tricolor LED
  • NRF24L01 transmitter
  • Ethernet shield

The plan is to have Arduino 1 read the ID on the card, turn LED yellow, call Arduino 2, which queries a php server, which replies YES/NO and if appropriate logs the time, and then if NO, Arduino 1 blinks red, if YES, Arduino 1 blinks green.

The flow seems simple enough, even though the code will probably be a headache.
What I cannot fathom for the life of me, is how the hell do I connect all of these parts together. I have a ton of pins on the sensors that seem to me to be demanding the same pins on the microprocessor.

Can you point me to the appropriate reading for "massive amount of connections"? I understand the command and control of simple LED/actuators/sensors ok, it's really the multiplicity that has me lost in the woods without even a carrot.

I would start with small projects just to test one step of the whole workflow. ANd when these all work in isolation merge them together into bigger miodules. MIght also help to keep the application modular.

Hoi Rob,
I understand your opinion, however this is not helping solving my question.
I know about modularity and divide et impera. However, my problem really lies with the electric underpinnings, which I really don't get.

In a layman's terms: "So what if I have all modules working just fine? Then I have lots of modules that do not solve my need, since I can't combine them in any way."

Surely, the solution isn't to "build my own shields for each element", or is it?
If I'm totally missing the point, don't hesitate to say so!
Dank u wel ^^

You are a self admitted "noob" that is "lost in the woods".

Yes, you are totally missing the point.

My guess is NOBODY is going to help you with this project as presented.

If on the other hand, you follow Robtillaart's advice and come back here with a specific question on how to display the data you have collected from an RFID card reader that you've hooked up on a little display that you have, showing the code you have tried, with a schematic or other representation of how things are attached, and lord forbid a data sheet or two on the components involved, you are MUCH more likely to get a useful response.

It sounds like an interesting project. It has a lot of steps. Break it down and do the steps.

Allow me to rephrase my obviously wrongly worded question.

I don't need help with the parts. I need help with understanding how you assemble parts.

I am a software engineer by trade. I hope that the forum can point me to the answer to a question such as "how to assemble complex parts together", since as far as I've read, there is no such documentation, either in the "learning" tab, or in the Massimo Banzi book.

If nobody knows the answer to my question, that's fine. However, telling me to solve less complex issues doesn't really help me.
My problem lies not in solving the simple issues, since with the datasheet freely available, and the code mostly pre-existing, it is a simple exercise in engineering (e.g., reuse and adaptation of existing solutions). I have all necessary data sheets. I have all the required code for the parts. Others have already solved these problems for me (and I have done my own research by myself).
If the forum can't help me, I'll seek out professionals, but I'd rather not waste their time if someone here can help me with a URL.
I feel right now like someone who has four wheels, a engine, a nice car enclosure and seats (etc), but doesn't know how to put them together. I don't need to test the wheels to be explained how the bigger picture of a car works, right?

My problem lies, exclusively, in my lack of understanding of the way Arduino projects deal with upscaling the number of components, and not interfacing with the components itself.

I hope I have, finally, been able to transmit the nature of my question, and apologize again for my failure to do so the first time.
Thanks for reading!

I prefer a diagram, but in lieu are we looking at this?

Arduino #1
RFID card
tricolor LED
display
NRF24L01 transmitter (transceiver?)

talks to

Arduino #2
NRF24L01 transmitter (transceiver?)
Ethernet shield

talks to

PC
php/mysql/?? server

At first glance I don't see anything "demanding the same pins" but that will depend on the interfaces for the RFID and NRF24L01. If they are both serial there may be issues but probably nothing insurmountable.


Rob

You appear to be asking two questions (that have some overlap): How do I get six complex components working together as a unit? How do I create a final deliverable?

Correct?

Yes, that is a very good way to reword my question! Thanks for helping me with that ^^

Unless your concern is around how to physically connect the components in the finished product, I think you're psyching yourself out. You can treat this just like a complex software project and simply modularlize and divide and conquer, as suggested. Most of your devices (apart from the ethernet shield) won't need to be using specific pins - you can specify them.

Once you have your database and PHP page ready, I'd start with the Uno and the ethernet shield and, using a few hard coded RFIDs, and test the functionality by having the Hello, Bye messages sent out of the serial port so you can view them on the PC .

Then I'd send those same hard coded message over the radio from the mini. etc etc - you already know this!

One issue I see is that on arduino 1, you will have two serial devices (Radio and RFID). It would be nice to use serial for debugging, so you would need to use softwareserial. Sadly, only one can be active at a time, so while you're talking on the radio, you can't receive from the RFID. Not insurmountable, but a little more complexity to manage. A mega might make life easier in this regard.

The LCD is a pain - it uses a lot of pins. Better perhaps to use one that you can command over serial (oops, another instance of SoftwareSerial to manage) or I2C.

In short, just try it. Don't worry about the finished product (despite how contrary that seems). Put the seats in, then take them out because its making it harder to jack the car up to put the wheels on. Put them back. Try to put the engine in, etc etc. Before you know it you'll be done and wondering what the mental block was that stopped you getting started.

OK wildbill, that pretty much clears my mind.

  • Set the pins to what I want
  • Use softwareserial
  • Deal with "interruptions" (talking to RFID versus talking to radio)

If the biggest issue comes from the LCD, it might be better to drop that part, since it is, after all, non essential, colour-coding being pretty universal?

Also, I2C seems to be a pretty powerful (and complex) beast. I guess this project is going to be very enlightening!

You don't "need" to use a complex multi-wire connection to the LCD. There are interface boards for that which use only 2 (I2C) or 3 (SPI type) wires. That gives some flexibility on which pins you are working with.

For example I2C is available on A4/A5 and all I2C devices can share that wire, as long as they have unique addresses.

Similarly the Latch/Data/Clock wiring scheme allows the use of any pins to drive the LCD.

code example here:

// *****************************************************************************
// ** DHT + SPI demo code 
// ** --------------------------------------------------------------------------
// ** Coding by:   Don Gibson  info@SmartGreenHouse.org
// ** Created:     April 17 2013
// ** Version:     1.5
// ** Last update: added DHT sensor  2013/04/19
// ** Modified by: DG
// ** This code is public domain, but please always include the original header
// ** in any subsequent copies
// ** Based on Adafruit sketch for I2C/SPI LCD backpack
// *****************************************************************************
// uses 
// uses DHT11 humidity sensor (1)
// uses 
// uses 20x4 SPI display
// uses CATkit (1)
// uses Kitten boards
// uses 1m, 5m, 20m CAT5 cables
// *****************************************************************************
/*
 Demonstration sketch for Adafruit i2c/SPI LCD backpack
 using 74HC595 SPI expander
 ( http://www.ladyada.net/products/i2cspilcdbackpack/index.html )

 Uses DHT-11 temperature humidity sensor
 On the Leonardo, pins D2, D3 are I2C so don't use these for Adafruit's 'SPI' at the same time
 
  The circuit:
 * 5V to Arduino 5V pin
 * GND to Arduino GND pin
 * CLK to Digital 2 (or D8 )
 * DAT to Digital 3 (or D9 )
 * LAT to Digital 4 (or D10) 
*/

// include the library code:
//#include "Wire.h"
#include "LiquidCrystal.h" // this is the Adafruit LiquidCrystal library
#include "DHT.h"

#define DHTPIN 1              // what pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11       // DHT 11 
//#define DHTTYPE DHT22       // DHT 22  (AM2302)
//#define DHTTYPE DHT21       // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);

// Connect via Adafruit 'SPI'. Data pin is #3, Clock is #2 and Latch is #4 on UNO
// Connect via Adafruit 'SPI'. Data pin is #9, Clock is #8 and Latch is #10 on Leonardo
// Relates to Kitten pins:  K2; K3; K1
LiquidCrystal lcd(9, 8, 10);

void setup() {

  // set up the LCD's number of rows and columns: 
  lcd.begin(20, 4);
  lcd.setBacklight(HIGH);
  // Print a message to the LCD.
  lcd.print(" SmartGreenHouse!");
  lcd.setCursor(0,1);
  lcd.print("Using 'SPI' protocol");
  lcd.setCursor(0,3);  
  lcd.print("CAT5 cable upto 100m");
}

void loop() {
  
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a slow sensor)
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) {
    Serial.println("Failed to read from DHT");
  } else {
    Serial.print("Humidity: "); 
    Serial.print(h);
    Serial.print(" %\t");
    Serial.print("Temperature: "); 
    Serial.print(t);
    Serial.println(" *C");
  }
  lcd.setBacklight(LOW);
  lcd.setCursor(0,2);
  lcd.print("Temp: "); 
  lcd.print (t);
  lcd.print("*C ");
  lcd.setCursor(10,2);
  lcd.print(" RH:"); 
  lcd.print (h);
  lcd.print("%");  
  delay(2000);
  lcd.setBacklight(HIGH);
}

Project showing how to build a remote LCD display: http://smartgreenhouse.org/images/downloads/mediavault/CATkits/SGH_LCBwithKitten.pdf

Thanks arbutus! Between you and wild bill, I have understood the elements I was missing.

Now, I'm only missing... hard work and testing, I guess :wink: