Arduino multiple NFC Reader RC522 over long distance with LTC6820 - arduino

I have a problem that I need to control two NFC RC522 over a long distance. Now I saw that there is LTC6820 IC that could make my life easier.
However in the datasheet it can be seen that the SPI slaves need an address to indentify, because the CS pin is not switched separately. Is there any way to classify an RC522 with an address and then be able to use it with an Arduino and the MFRC522 library?
Here is a datasheet of the LTC6820: https://www.analog.com/media/en/technical-documentation/data-sheets/LTC6820.pdf
In the datasheet (https://www.nxp.com/docs/en/data-sheet/MFRC522.pdf) of the RC522 there is something about addressing in the bullet point 8.1.2.3, but I don't understand it yet.
I hope someone can tell me about a multidrop connection with the LTC6820 with RC522 slaves.

The MFRC522 data sheet 8.1.2.3, refers to using SPI to read and write register addresses within the MFRC522 rather than accessing two MFRC5 on the same SPI bus.
The only way to use SPI for 2 separate devices is to run separate CS lines to the CS pin on each IC.
You can also use I2C slave interface and then MFRC522 can be hardwired to several I2C addresses on one I2C bus. I2C can cover somewhat longer distances than SPI, dependent on clock speed you select and can be extended further using differential I2C https://www.nxp.com/docs/en/data-sheet/PCA9615.pdf
Unfortunately it does not look like the official Arduino MFRC522 library has great I2C support though. https://github.com/makerspaceleiden/rfid#what-works-and-not

Related

I2C on ESP32 or Arduino: what's the max number of slaves using the BMP388 sensor

BMP388: what is the maximum of slave addresses in I2C mode
In I2C mode with one master how many BMP388 as slave can be connect to an Arduino UNO?
From the datasheet I understand that there are only 2 adresses possible in I2C mode (0x76 or 0x77) as designated by bit 7 in the device address and configured via the SDO (pin 5) port to ground or plus.
In SPI mode, as I hope to understand well from the datasheet, it's up to 128 BMP388 addresses.
My questions are:
-Am I understanding well that in I2C mode the maximum number of slaves is two?
-Of course I can connect a lot of BMP388's in series to the Arduino, but how can I address them in I2C mode. Or should I use SPI mode?
-Is there any documentation, except the datasheet, that makes this more clear?
-Is there any example Arduino code for the I2C situation?
You understood the i2c addressing correctly. There can only be 2 addresses for
BMP388 controlled by SDO pin in i2c mode.
If you want to use more than 2 BMP388 units with a single microcontroller, go with SPI. You can use as many BMP388 units as you have GPIO pins on microcontroller to control Slave Select pin.
This is the example from Adafruit BMPxxx library.
Here is permalink to the line where you can pass Slave Select (CS) pin of each unit to each unique object.
Later in the code you can use each object of the Adafruit BMPxxx library to get the readings.

I2C COMMUNICATION

one micro-controller support all adc dac, spi, uart except I2C, but i want to use i2c communication.How to make i2c port using these protocol?
It would help if you told us which microcontroller you are using, and whether you need your micro to be an I2C master, a slave, or either.
If you just need to an I2C master, and you don't need to worry about other masters on the same bus (arbitration) or very slow slave devices (clock stretching), then I2C is very simple to implement using two GPIO pins. Search for " software i2c master" and you'll find things like I2C Implementation on 8051.
If you need to do arbitration because there may be multiple masters on the bus, or if you need to handle slave clock stretching, then read the I2C specification from Philips NXP. Take the simple code you find through Google and add the functionality you need.

Pin reading between arduinos

I'm working a little project where I make my own version of serial communication between 2 arduino megas using their digital I/O pins.
So there are a couple digital pins on arduino A that are set as output. These are plugged into two digital pins in arduino B which are set as input. Is there a way for arduino B to detect whether the output pins coming from arduino A are high or low?
I know this can be done with transistors, but is there a way to do it without them?
The digital pins from one Arduino can be connected directly to the digital pins on the other - no need for any transistors in between. Make sure there is a common ground between them so both boards are at the same reference level (connect the GND pins, or power both from the same supply).
You can read the digital pins on the receiving end by calling digitalRead(), and write to the digital pins on the sending end by calling digitalWrite(). Whatever protocol you implement will need to detect the high/low transitions and decode them accordingly.
I guess I'm curious why you wouldn't just use the built-in serial ports to communicate, unless this is just a learning exercise? Certainly worthwhile for learning, but unnecessary extra work otherwise...

Arduino Multiple SPI devices including CC3000 and MFRC522

I'm asking if how can I implement this one. I'm aware about multiple devices being connected over SPI, like having to select individual SS pin for each. Adafruit's CC3000 works fine alone along with the default Adafruit library. CC3000 uses SPI. MFRC522 RFID module by sonmicro (bought at Sparksfun) uses SPI too. It works fine too, independently. But whenever I connect them together, only WiFi works perfectly. I dont want to turn on and off the wifi to make way for the RFID to communicate since it takes some time for it to be connected in a wireless network. I want the two to work synchronously (or having to be scheduled but really fast that's unnoticeable by the user)
here's my code as of now. i cannot post it here as strange things happen i don't know why haha
https://drive.google.com/file/d/0B0bZsYo0xMH8YV9uWXJaRFdPT3M/view?usp=sharing
I'm thinking of replacing the RFID with SonMicro's SM130 RFID Module w/ SparkFun Eval board with UART (convertible to I2c) or Adafruit's PN532 with I2c by default. Are these okay to be paired with SPIs like the CC3000? Or should I change CC3000 with the Official WiFi module (UART) or WiFly Module (SPI-to-UART)

Arduino Wifi Shield SPI commands

I'm currently using the Arduino Wifi Shield. It works fine with the Arduino Library, but I have a project in which I need to get rid of all the Arduino library, and use only the AVR-libc.
Therefore, in order to use the Wifi shield, I would like to know where there is a documentation about the protocol used on the SPI bus between the arduino and the shield, so that I do not need to use the Wifi Library.
Am I forced to look at the source code, or does any document exist?
Thanks.
The documentation for SPI will be contained in the datasheet for the MCU used in the Arduino. For AVR-based Arduinos, look in the section titled "SPI – Serial Peripheral Interface". For the Arduino Due, see the "Serial Peripheral Interface (SPI) Programmer Datasheet" section.

Resources