You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/02.hero/shields/spe-shield/tutorials/getting-started/spe-getting-started.md
+254-6Lines changed: 254 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -387,12 +387,101 @@ The architecture consists of three layers: a central control node that issues co
387
387
388
388
### Central Control Node (Server)
389
389
390
-
The central control node (Node 7) acts as the command center of the system, sending LED control commands to specific Opta boards through their associated gateway nodes. Operating on the SPE network, this node provides a simple serial interface where operators can type commands like "LED 3" to toggle specific LEDs on remote Optas.
390
+
The central control node (Node 7) acts as the command center of the system, sending LED control commands to specific Opta boards through their associated gateway nodes. Operating on the SPE network, this node provides a simple serial interface where operators can type commands like "LED 3" to toggle the LEDs on remote Optas.
Serial.println("Invalid command. Use: LED 0, LED 1, etc.");
482
+
}
483
+
}
484
+
}
396
485
```
397
486
398
487
### Transducer Node SPE/RS-485
@@ -401,10 +490,125 @@ The gateway nodes serve as protocol translators between the SPE network and RS-4
401
490
402
491

403
492
404
-
When an Opta board responds via RS-485, the gateway captures the response and sends it back to the central controller as a UDP packet. This bidirectional translation allows transparent communication between the SPE-based control system and RS-485 devices, making it possible to control multiple Opta boards from a single point on the network.
405
493
406
494
```arduino
407
-
In Progress
495
+
// SPE/RS-485 Gateway Node - Forwards LED commands to Opta
496
+
#include <Arduino_10BASE_T1S.h>
497
+
#include <SPI.h>
498
+
499
+
const uint8_t MY_ID = 0; // Gateway node ID (change for each gateway)
500
+
501
+
// Network setup
502
+
IPAddress myIP(192, 168, 42, 100 + MY_ID);
503
+
IPAddress netmask(255, 255, 255, 0);
504
+
IPAddress gateway(192, 168, 42, 100);
505
+
506
+
// RS-485 control pins
507
+
#define RS485_DE_PIN 7
508
+
#define RS485_RE_PIN 8
509
+
510
+
TC6::TC6_Io* io;
511
+
TC6::TC6_Arduino_10BASE_T1S* network;
512
+
Arduino_10BASE_T1S_UDP* udp;
513
+
514
+
void setup() {
515
+
Serial.begin(115200); // USB debug
516
+
Serial1.begin(9600); // RS-485 to Opta
517
+
delay(1000);
518
+
519
+
Serial.print("\n=== SPE/RS-485 Gateway Node ");
520
+
Serial.print(MY_ID);
521
+
Serial.println(" ===");
522
+
Serial.println("Forwarding LED commands to Opta");
523
+
524
+
// Setup RS-485 pins
525
+
pinMode(RS485_DE_PIN, OUTPUT);
526
+
pinMode(RS485_RE_PIN, OUTPUT);
527
+
setTransmitMode(); // We only transmit to Opta
528
+
529
+
// Initialize SPE network
530
+
io = new TC6::TC6_Io(SPI, CS_PIN, RESET_PIN, IRQ_PIN);
@@ -413,10 +617,54 @@ The Arduino Opta boards represent the end devices in this system, receiving comm
413
617
414
618

415
619
416
-
When an Opta receives a command, it parses the instruction, performs the requested operation. This simple protocol allows the central SPE controller to remotely monitor and control multiple Opta boards across the RS-485 network, creating a flexible and scalable industrial control system.
620
+
When an Opta receives a command, it parses the instruction, performs the requested operation. This simple protocol allows the central SPE controller to remotely monitor and control multiple Opta boards across the RS-485 network, creating a flexible and scalable system.
417
621
418
622
```arduino
419
-
In progress
623
+
// Arduino Opta - Toggles built-in LED on command
624
+
#include <ArduinoRS485.h>
625
+
626
+
bool ledState = false;
627
+
628
+
void setup() {
629
+
Serial.begin(115200); // USB debug
630
+
delay(2000);
631
+
632
+
Serial.println("\n=== Opta LED Controller ===");
633
+
Serial.println("Toggles built-in LED on command");
634
+
635
+
// Initialize RS-485 with delays
636
+
RS485.begin(9600);
637
+
RS485.setDelays(1000, 1000); // Pre and post delays in microseconds
0 commit comments