37 Commits

Author SHA1 Message Date
5e42113d2e Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-09-18 22:32:24 +02:00
4915c7bf51 Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-09-18 22:31:48 +02:00
9e1f336a8b Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-09-18 21:55:05 +02:00
a681d189dc Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-09-18 21:54:14 +02:00
f596a5bbd0 Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-09-09 23:44:46 +02:00
2af1db36ec Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-09-09 23:44:26 +02:00
db508a9dd1 Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-09-09 17:51:47 +02:00
e9afd6fcce Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-09-09 17:51:18 +02:00
c0fdf6b540 Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-09-08 23:44:59 +02:00
8bdcfb6032 Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-09-08 23:44:51 +02:00
573eb5e85f Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-09-03 13:08:40 +02:00
6a2184f33d Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-09-03 13:08:26 +02:00
73304368b3 Merge branch 'nano-revision-2.1' into nano-revision-2.2
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2024-09-01 09:59:46 +02:00
b6723b92fc Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-09-01 09:58:01 +02:00
769786e63a fixed revision
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2024-06-11 10:54:07 +02:00
67313e26a5 Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-06-11 10:52:50 +02:00
44fd0050e3 Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-06-11 10:50:51 +02:00
17959d9af2 Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-05-25 09:31:31 +02:00
6e8016e718 Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-05-25 09:30:41 +02:00
9c01c18407 Merge branch 'nano-revision-2.1' into nano-revision-2.2 2024-05-23 21:46:10 +02:00
d65586ba0b Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-05-23 21:45:45 +02:00
ef2488363d Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-04-13 17:04:08 +02:00
a54897a4b5 Merge branch 'nano-revision-2.0' into nano-revision-2.1 2024-04-13 16:17:14 +02:00
74a5cfa41c Merge branch 'nano-revision-2.1' into nano-revision-2.2 2023-12-19 15:28:01 +01:00
fcbde966e3 Merge branch 'nano-revision-2.0' into nano-revision-2.1 2023-12-19 15:26:22 +01:00
72153daeeb Merge branch 'nano-revision-2.1' into nano-revision-2.2 2023-12-19 00:51:14 +01:00
70425f8d22 Merge branch 'nano-revision-2.0' into nano-revision-2.1 2023-12-19 00:50:03 +01:00
faf3f4ece3 Merge branch 'nano-revision-2.1' into nano-revision-2.2 2023-12-19 00:30:45 +01:00
d0528773ec Merge branch 'nano-revision-2.0' into nano-revision-2.1 2023-12-19 00:28:27 +01:00
8e02709b32 fixed LCDReceiver for communication with RS485 rev 2.x boards
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2023-12-19 00:20:53 +01:00
65501447fd pin change
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2023-12-16 17:58:27 +01:00
f4aef1cd0e imroved layout:
1. more space for RJ45 connector
2. added diode at voltage input clamp

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2023-12-16 13:56:01 +01:00
247f061c2f Merge branch 'nano-revision-2.0' 2023-12-16 13:53:58 +01:00
3661309081 Merge branch 'nano-revision-2.0' 2023-12-03 12:47:17 +01:00
0ce4f0cd4d Projekt aufgeräumt
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2023-12-03 12:11:16 +01:00
ca66b1c380 Board nochmals überarbeitet
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2023-11-30 03:12:37 +01:00
594e8ea06c Bugfix: RO des Max485 nun mit einem Interrupt-Pin verbunden
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2023-11-28 02:32:38 +01:00
9 changed files with 42 additions and 192 deletions

Binary file not shown.

View File

@@ -2,3 +2,4 @@
|-------|------------------|-----------------|---------|---------|
| 1.0 | D2 | D3 | U7 | U8 |
| 2.0 | D2 | (D10)| U8 | U7 |
| 2.1 | D3 | D2 | U8 | U7 |

View File

@@ -1,95 +0,0 @@
/* RS 485-Implementierung, die sowohl Schreiben als auch Lesen kann */
/* Basis für andere Projekte */
#define BUTTON 2
#define RECEIVE 3
#define RECEIVE_ENABLE 4
#define SEND 5
#define SEND_ENABLE 6
#define MAX_LEN 128
void setup() {
// Buttons connected to analog input lines
pinMode(A0,INPUT_PULLUP);
pinMode(A1,INPUT_PULLUP);
pinMode(A2,INPUT_PULLUP);
pinMode(A3,INPUT_PULLUP);
pinMode(A4,INPUT_PULLUP);
pinMode(A5,INPUT_PULLUP);
pinMode(A6,INPUT_PULLUP);
pinMode(A7,INPUT_PULLUP);
// Currently, all buttons are also connected via a diode to an interruptable pin, to notify on input changes.
// This interruptable pin should be assgined to BUTTON
pinMode(BUTTON,INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(BUTTON),button,FALLING); // interrupt for button change
// Set up pins for RS485 connection
pinMode(RECEIVE, INPUT);
pinMode(RECEIVE_ENABLE, OUTPUT);
pinMode(SEND, OUTPUT);
pinMode(SEND_ENABLE, OUTPUT);
attachInterrupt(digitalPinToInterrupt(RECEIVE),receive,CHANGE); // interrupt for incoming RS485 traffic
reset485();
buttons = 0x0;
}
void button() {
buttons = 0xFF ^ (digitalRead(A7)<<7 | digitalRead(A6)<<6 | digitalRead(A5)<<5 | digitalRead(A4)<<4 | digitalRead(A3)<<3 | (!digitalRead(A2))<<2 | digitalRead(A1)<<1 | digitalRead(A0));
}
void receive(){
bool received_bit = digitalRead(RECEIVE);
curr = micros();
duration = curr - last;
Serial.print("Input switched to ");
Serial.print(received_bit?"H":"L");
Serial.print(" after ");
Serial.print(duration);
Serial.println(" ticks");
last = curr;
if (duration > MAX_TICKS) reset485();
received_bit = !received_bit; // received_bit is the current value, the duration of the previous value (=inverted) has been measured
duration /= BASE;
while (duration > 0){
byte_idx--;
recv |= received_bit<<byte_idx;
if (byte_idx == 0) {
msg[msg_idx] = recv;
msg_idx++;
byte_idx = 8;
if (recv == 0x00) message_received();
}
duration--;
}
}
void reset485(){
byte_idx = 8;
msg_idx = 0;
recv=0x0;
}
void message_received(){
for (int i=0; i<MAX_LEN; i++) message[i]=msg[i];
reset485();
}
void button_pressed(int i){
Serial.println("not implemented");
}
void loop(){
if (buttons>0){
for (int i=0; i<7; i++){
if (buttons & (1<<i)) button_pressed(i);
}
}
if (message[0] != 0x0){
Serial.print("Received '");
Serial.print(message);
Serial.println("'");
message[0] = 0x0;
}
}

View File

@@ -9,19 +9,19 @@
#include <LiquidCrystal.h>
#include <SoftRS485.h>
#define PROGRAM "RS485-Nano Rev 2.0 / LCDReceive 1.2"
#define Max485_RO 2 // read-output of Max485
#define Max485_RE 8 // not-read-enable of Max485
#define Max485_DE 8 // data enable of Max485
#define Max485_DI 9 // data input of Max485
#define Max485_RO 3 // read-output of Max485
#define Max485_RE 5 // not-read-enable of Max485
#define Max485_DE 9 // data enable of Max485
#define Max485_DI 8 // data input of Max485
#define LCD_RS 10
#define LCD_EN 11
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7
#define LCD_RS 4
#define LCD_EN 6
#define LCD_D4 7
#define LCD_D5 11
#define LCD_D6 12
#define LCD_D7 13
#define PROGRAM "RS485-Nano 2.2 / LCDReceive 1.2"
// initialize the library by associating any needed LCD interface pin with the arduino pin number it is connected to
LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
@@ -29,10 +29,12 @@ LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
void setup() {
Serial.begin(115200);
init485(Max485_RO,Max485_RE,Max485_DE,Max485_DI); // library initialization:
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.begin(16, 4);
// Print a message to the LCD.
printMessage(PROGRAM);
}
void printMessage(String s){
@@ -43,6 +45,7 @@ void printMessage(String s){
auto cstr = s.c_str();
for (int i=0;i<s.length();i++){
if (col == 0 && cstr[i] == ' ') continue;
if (cstr[i] == '{' || cstr[i] == '}') continue;
lcd.print(cstr[i]);
col++;
if (cstr[i]==',' || col==16){

View File

@@ -1,61 +0,0 @@
// Für Controllino könnte man benutzen: sRx = 20, sTx = 21, enable = 53
int sTx = 2;
int sRx = 3;
long base = 100;
long rst = base*10; // reset
boolean bt = false;
long dif = 0;
long lt = 0;
long now = 0;
char rcv = 0;
int idx = 0;
String message;
void setup(){
pinMode(sRx,INPUT);
pinMode(sTx,OUTPUT);
attachInterrupt(digitalPinToInterrupt(sRx),change485,CHANGE);
Serial.begin(115200);
Serial.println("Receiver ready");
}
void reset485(long dif){
rcv = 0;
idx = -1;
message.reserve(32);
}
void change485(){
bool bt = digitalRead(sRx);
now = micros();
dif = now - lt;
lt = now;
if (dif > rst){
reset485(dif);
} else {
handle485(!bt,dif);
}
}
void handle485(boolean bt, long dif){
long count = dif/base;
for (int i=0; i<count; i++) push485(bt);
}
void push485(boolean bt){
if (idx>=0) rcv |= bt<<idx;
idx++;
if (idx == 8){
if (rcv == 13) {
Serial.println(message);
message = "";
} else {
message+=rcv;
}
idx =0;
rcv =0;
}
}
void loop(){}

View File

@@ -20,13 +20,13 @@
#define ID 0
#define PROGRAM "Sender"
#define SW_VERSION "1.3"
#define HW_VERSION "2.0"
#define HW_VERSION "2.2"
#define BTN_INT 2 // button interrupt pin
#define Max485_RO 3 // read-output of Max485
#define Max485_RE 5 // not-read-enable of Max485
#define Max485_DE 9 // data enable of Max485
#define Max485_DI 8 // data input of Max485
#define BTN_INT 3 // button interrupt pin
#define Max485_RO 2 // read-output of Max485
#define Max485_RE 3 // not-read-enable of Max485
#define Max485_DE 8 // data enable of Max485
#define Max485_DI 9 // data input of Max485
#define TRESHOLD 1024
#define TRIGGER_LEVEL 200
@@ -81,7 +81,7 @@ void isr(){
raw_states[7] = analogRead(21)<TRIGGER_LEVEL;
#ifdef LOG_TO_SERIAL
for (int i=0;i<8;i++){
Serial.print(" ");
Serial.print(" ");
Serial.print(raw_states[i]);
Serial.print(" ");
}

View File

@@ -8,12 +8,13 @@
// include the library code:
#include <SoftRS485.h>
#define Max485_RO 3 // read-output of Max485
#define Max485_RE 5 // not-read-enable of Max485
#define Max485_DE 9 // data enable of Max485
#define Max485_DI 8 // data input of Max485
#define PROGRAM "{hw:RS485-Nano rev 2.0,firmware:Transceiver,version:1.0}"
#define Max485_RO 2 // read-output of Max485
#define Max485_RE 3 // not-read-enable of Max485
#define Max485_DE 8 // data enable of Max485
#define Max485_DI 9 // data input of Max485
#define PROGRAM "{hw:RS485-Nano rev 2.1,firmware:Transceiver,version:1.0}"
String message = "";
char c;

View File

@@ -21,15 +21,15 @@
// 6=Bad OG
#define ID 0
#define HW_VERSION "2.0"
#define HW_VERSION "2.2"
#define PROGRAM "TempSender"
#define SW_VERSION "1.5"
#define BTN_INT 2 // button interrupt pin
#define Max485_RO 3 // read-output of Max485
#define Max485_RE 5 // not-read-enable of Max485
#define Max485_DE 9 // data enable of Max485
#define Max485_DI 8 // data input of Max485
#define BTN_INT 3 // button interrupt pin
#define Max485_RO 2 // read-output of Max485
#define Max485_RE 3 // not-read-enable of Max485
#define Max485_DE 8 // data enable of Max485
#define Max485_DI 9 // data input of Max485
#define TRESHOLD 1024
#define TRIGGER_LEVEL 200
@@ -47,6 +47,7 @@ unsigned long capacitor[8];
unsigned long times[8];
unsigned long sensor_time = 0;
// these values are used for temperature processing
SimpleDHT22 sensor(DHT_PIN);
float temperature = 0;
float humidity = 0;

View File

@@ -24,13 +24,13 @@
#define ID 0
#define PROGRAM "Temp+IR"
#define SW_VERSION "0.1"
#define HW_VERSION "2.0"
#define HW_VERSION "2.1"
#define BTN_INT 2 // button interrupt pin
#define Max485_RO 3 // read-output of Max485
#define Max485_RE 5 // not-read-enable of Max485
#define Max485_DE 9 // data enable of Max485
#define Max485_DI 8 // data input of Max485
#define BTN_INT 3 // button interrupt pin
#define Max485_RO 2 // read-output of Max485
#define Max485_RE 3 // not-read-enable of Max485
#define Max485_DE 8 // data enable of Max485
#define Max485_DI 9 // data input of Max485
#define TRESHOLD 1024
#define TRIGGER_LEVEL 200