-1

I am starting on my E-ink project, but I got stuck. This is the connection diagram I made based on the three components. An SD card module, an E-ink screen module (screen not visible now), and the Arduino uno.

modules and connections : image of modules and connections.

I know that both modules work when I connect them separately to the Arduino in this way, but when I want to connect both, 3 wires overlap as you can see (red cirkels). I understand that you have to put the CS (or SS, source select, different name, same thing) of both modules on a separate pin. How do I do this best? I only see one SS (or CS) port on the Arduino uno, see attachment. Can I set another port as SS or is that not possible? I also have two other cables on the same port. I understood from the internet that: sdi = mosi and sck = miso so I can connect them to the same port. It is especially important that you make it clear which slave you want to use at what time. The data lines are used for both modules, they don't need separate data lines, see SPI diagram image.

I also have a programming question that goes along with the first question. The program I want to make is as follows in psuedo code:

-Power on-

Setup;
Turn off sd card,
Turn off e-ink screen,
.bmp counter = 0;

Loop;
{
Turn on sd card,
Open sd card and read .bmpcounter value (which image the uC should read),
Load that .bmp file into ram memory,
Turn on e-ink screen,
Draw .bmp file on the screen,
Turn off e-ink screen,
Turn off sd card,
SD card .bmp counter +1 (go to next image),
Count up to 24 hours in low power mode,
Get out of low power mode,
}

How can I translate this to Arduino IDE or c++?

If this really isn't possible with this Arduino (I assume it is, because others have also managed to do it with more complicated ideas with e-ink), I also have other uCs, such as the raspberry pi pico, but I would prefer use it because of the available documentation and arduino IDE programming environment.

I would very much like to hear from you how I can approach this. Thank you for your time,

-Casper Tak

Jin Lee
  • 3,194
  • 12
  • 46
  • 86

1 Answers1

0

I want to connect both, 3 wires overlap as you can see (red cirkels). I understand that you have to put the CS (or SS, source select, different name, same thing) of both modules on a separate pin. How do I do this best? I only see one SS (or CS) port on the Arduino uno, see attachment.

You enable the slave device you want to communicate with by pulling its SS/CS pin low. That way you can USE MOSI, MISO and SCK for multiple devices. Any digital pin will do. You don't need Arduino Unos SS as Arduino is the master in this scenario.

I understood from the internet that: sdi = mosi and sck = miso so I can connect them to the same port. I

No.

  • MOSI (master out, slave in) sends data from the master to the slave
  • MISO (master in, slave out) receives data from the slave
  • SDI/SDO (serial data in/out) are alternative names, usually from the device's perspective
  • SCK (serial clock) master provides a clock over this pin. this is not miso!

How can I translate this to Arduino IDE or c++?

You learn the basics of C++ and ideally read the Arduino manual as well as the datasheets for the modules and the manuals for their libraries. This is not a coding service.

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • Ok, thanks a lot! I do have some basics when it Comes to C++. I study electrical engineering, but i'm still a first year student. – Casper Tak Mar 03 '21 at 19:10
  • Just to be clear, sdi is the same as midi, it is just a different name? It may be rude to ask, but do you think my diagram is correct? – Casper Tak Mar 03 '21 at 19:29
  • midi stands for musical intstrument digital interface. not sure how you relate this to spi. mosi and miso speak for themselves. sdi and sdo are from the device perspective. so if both devices use miso/mosi you connect mosi to mosi, miso to miso. if master has mosi/miso labels and slave sdi, sdo you connect mosi to sdi, miso to sdo. if both have sdi/sdo you connect sdi to sdo and sdo to sdi. some slaves also use simo and somi. sor so, si. but the principle is always the same. if the direction is not in the name its from the devices perspecitve. – Piglet Mar 03 '21 at 20:33
  • your circuit is incorrect. my post should make clear what you need to do. why would you connect the clock pin to anything but the clock? or why should the communication line be connnected to chip select? that doesn't make sense. reading the Arduino manual and at least the wikipedia article on spi should have answered your questions btw. you should make reading any documentation a habit as a engineering student – Piglet Mar 03 '21 at 20:41
  • i'm sorry. I editted the previous message on my phone. I was a bit too quick and auto correct took over. "I meant is SDI the same as MOSI?" but I now understand your message. it's rather confusing that they use 2 different names. I will reconnect everything. Also I did make some documentation. I use the MoSCoW method as well as some schematic and other documents. It's work in progress. This was the first schematic one, but is incorrect as you stated. Thank you for your time and if I have more questions related to this, can I ask them here? – Casper Tak Mar 03 '21 at 20:59
  • this is a programming community. questions like this are usually closed for being off-topic. the different names are not confusing if you know what they mean. right now they're about to remove names like master and slave from all kinds of stuff so don't get used to mosi and miso too much :) – Piglet Mar 03 '21 at 21:19
  • Ok thanks, next time i'll use a differt forum for my hardware/connection questions. But your answer helped me a lot anyways. Just needed some clarification and a push in the right direction. Have a nice evening. This topic may be closed now. – Casper Tak Mar 03 '21 at 21:39