DMD library, RTC and Ethernet with Arduino Uno?

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
dogank
Posts:3
Joined:Tue Jun 23, 2020 7:12 am
DMD library, RTC and Ethernet with Arduino Uno?

Post by dogank » Tue Jun 23, 2020 7:21 am

Hello:!: :!: :!: ,

I am using DMD library and also ds1307. It works with I2C protocol. I am going to use ethernet to communicate with dmd p10 panels. As i read, people says different things. It works or not works.

I am not using DMD2 library. I am using DMD library. Can i use ethernet module + dmd panel + rtc? with arduino uno. I will use ENC28J60 Ethernet - LAN module (its image: https://prnt.sc/t4sfra). I am worried about conflict of dmd and ethernet because both of them use spi and arduino uno has only one spi. I can not be able to change dmd pins to Analog pins because A4 and A5 pins are connected to I2C that i use.

Regards,
Dogan

Brissieboy
Posts:209
Joined:Fri Sep 20, 2013 7:25 am

Re: DMD library, RTC and Ethernet with Arduino Uno?

Post by Brissieboy » Tue Jun 23, 2020 9:34 am

The DS1307 just uses I2C, the DMD library uses timerone and SPI, and they will play nicely together. The ENC28160 appears to use SPI as well but you will not be able to share the SPI buss as the DMD does not use a chipselect though the ENC28160 does. There may be options available to you for another SPI on the Uno such as this one.
No experience with the ENC28160 so there may be other conflicts as well.

dogank
Posts:3
Joined:Tue Jun 23, 2020 7:12 am

Re: DMD library, RTC and Ethernet with Arduino Uno?

Post by dogank » Fri Jun 26, 2020 8:19 am

I can't see anything on the dmd panel when i add ethercard code. Without ethernet i can type something on dmd p10 panels. Where is my mistake? At the ether.begin function i write 10 for spi chip select even thought i can't see any text on panels.

Code: Select all

#include <EEPROM.h>
#include <Wire.h>
#include "RTClib.h"
#include <SPI.h>       
#include <DMD.h>    
#include <TimerOne.h>  
#include <EtherCard.h>
#include <IPAddress.h>
#include "SystemFont5x7.h"
#include "Font_6x14.h" //-> This font only contains numbers from 0-9

#define DISPLAYS_ACROSS 2 //-> Number of P10 panels used, side to side.
#define DISPLAYS_DOWN 2
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

//#define SPI_SS 10

int kAdres1=11;
String bb;
//------------------------------------------------------------------------------
#define STATIC 1  // set to 1 to disable DHCP (adjust myip/gwip values below)

#if STATIC
// Ethernet interface IP address
static byte myip[] = { 192,168,1,175 };
// Gateway IP address
static byte gwip[] = { 192,168,1,1 };
static byte mask[] = { 255,255,255,0 };
static byte dnss[] = {  192,168,1,1 };
#endif

// Ethernet MAC address - must be unique on your network
static byte mymac[] = { 0x70,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[500]; // TCP/IP send and receive buffer
/*
// Callback that prints received packets to the serial port
void udpSerialPrint(uint16_t dest_port, uint8_t src_ip[IP_LEN], uint16_t src_port, const char *data, uint16_t len){
  IPAddress src(src_ip[0],src_ip[1],src_ip[2],src_ip[3]);

  Serial.print("dest_port: ");
  Serial.println(dest_port);
  Serial.print("src_port: ");
  Serial.println(src_port);

  Serial.print("src_ip: ");
  ether.printIp(src_ip);
  Serial.println("data: ");
  Serial.println(data);

  char textToSend[] = "AABBCCDDEEFFGGHH";
  //src_ip
  ether.sendUdp(textToSend, sizeof(textToSend), src_port, src_ip, dest_port );
}*/
//--------------------------------------------------------------------------------------

RTC_DS1307 rtc; //-> RTC Declaration

char msg1[]="HELLO";
char data[] = "HELLO HELLO";
//--------------------------------------------------------------------------------------ScanDMD()
void ScanDMD() { 
  dmd.scanDisplayBySPI();
}
//--------------------------------------------------------------------------------------setup
void setup() {
  Serial.begin(9600);
  delay(1000);

  Timer1.initialize(1000);          
  Timer1.attachInterrupt(ScanDMD);   
  dmd.clearScreen(true);  
  ether.begin(sizeof Ethernet::buffer, mymac, 10);
  
  // Change 'SS' to your Slave Select pin if you aren't using the default pin
  if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 0)
    Serial.println(F("Failed to access Ethernet controller"));
#if STATIC
  ether.staticSetup(myip, gwip, dnss, mask);
#else
  if (!ether.dhcpSetup())
    Serial.println(F("DHCP failed"));
#endif

  ether.printIp("IP:  ", ether.myip);
  ether.printIp("GW:  ", ether.gwip);
  ether.printIp("DNS: ", ether.dnsip);

  Register udpSerialPrint() to port 1337
//  ether.udpServerListenOnPort(&udpSerialPrint, 3000);
}
//--------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------loop
void loop() {
  ether.packetLoop(ether.packetReceive());
  dmd.selectFont(SystemFont5x7); 
  
  dmd.drawChar(1,1,data[2] ,1,GRAPHICS_NORMAL); // bura bak
  
  
  delay(2000);
}

}

Post Reply