I am having main controller circuit board that give the data such as ("HAI", "HELLO") to 5 pin SPI Connector mounted on the same board. In that 5 pin SPI connector I could connect separate circuit board which has SPI based 5 SEVEN segment LED to see the output for e.g. ("HAI", "HELLO").

Pin configuration for 5 pin SPI connector on main circuit board.

  • Pin 1 - VCC
  • Pin 2 - GND
  • Pin 3 - CS (chip selection)
  • Pin 4 - CLK (clock)
  • Pin 5 - D IN (Data).

Everything working fine and also I can see the output data on the SEVEN-segment display such as "HAI" and "HELLO" through my naked eye.

But I need the same data to display in my PC/Laptop console so I used Arduino uno controller setup.

So I did connecting wire from Arduino controller to 5 pin connector of main controller circuit board.

Connections below.

Arduino controller                 Main controller ckt board
(Digital pins)                      (5 Pin connector)
PIN 7 (D IN) --------------------------->   PIN 5 (D IN)
PIN 6 (CS)   --------------------------->   PIN 3 (CS)
PIN 5 (CLK)  --------------------------->   PIN 4  (CLK)

I connected USB cable to my PC and I installed arduino driver and also configured COM PORT (COM5 my-case).

I opened Hyper-terminal console in that I chosen COM5 and baud rate 9600. But still I did not get the output ("HELLO", "HAI") on the console because the Arduino controller does not have source code for reading the output string("HELLO", "HAI") from the 5-pin SPI connector on main ckt controller board.

What I need exactly?

  1. I need a source code that for reading the output from 5 pin connector through SPI and should display on my console.

Can anyone share the full source code for do that above operation ?

  • 1
    first wire it to SPI pis of Uno. then use SPI library in slave mode. the device will send not only the text. it is possible it will send only the segment addresses with states – Juraj Feb 14 '19 at 15:47

Need to start with the correct pins.

With Uno, SCK is 13, MISO is 12, MOSI is 11, and typically 10 is used for slave select.

To read from a slave device, some setup is needed, then the command is run. Here's a very simple example:

byte ssPin = 10;
byte incomingByte;
byte addressToRead = 0x00; // or what is needed, if needed.

void setup(){
pinMode (ssPin, OUTPUT);
digitalWrite (ssPin, HIGH); // most devices expect a LOW for slave select
// the code in behind SPI.transfer may do this already, I put it in anyway as
// sometimes I use different pins.  10 needs to be an output for the 
// Atmega to be the SPI bus master

SPI.begin(); // uses default values: SCK of 4 MHz, MSBFIRST, Mode 0 for
//              initial signal levels

void loop(){
digitalWrite (ssPin, LOW); // select the device
SPI.transfer (addressToRead); // may be needed for your device
incomingByte = SPI.transfer(0); // read a byte from the slave 
digitalWrite (ssPin, HIGH); // deselect the device

Serial.print(incomingByte); // may need some manipulation to make this 
//                             a printable character - see 
//                             www.asciitable.com
delay(500); // keep from flooding the PC screeen
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.