Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
- Jmriusers
- Messages
Search
Locked
Re: How to change the systemName of a turnout or block in a script?
#scripting
I've done the sequence like Cliff described while a layout is being constructed.
We started with a all Internal layout design as part of the planning process for the layout. Then as we built and installed electronics, I would move the user names to real hardware. This kept is as a bunch of smaller batches of changes. Then we used the panel to test the new hardware on the layout. Repeat as needed. -Ken Cameron, Member JMRI Dev Team www.jmri.org www.fingerlakeslivesteamers.org www.cnymod.com www.syracusemodelrr.org |
Blair
That's very interesting. Okay, so if Nano's are 5v then we would still need the Level Shifters. Not s problem, just trying to work out in my head what we might need. Forgive my ignorance, but would we need a MAX485? Are you thinking of connecting multipe Arduino/reader boards together on a RS485 bus and having one connection to a computer? That would certainly be interesting.? Steve |
On Tue, Apr 25, 2023 at 06:21 PM, <stephenjohnson500@...> wrote:
I uploaded the latest sketch and tried it first with just the Uno. Unfortunately it didn't read any tags. I then tried it with the shield added, it still didn't read any tags whether the Cat5 was plugged in or not. I then tried connecting it to JMRI and it continually refused the connection stating 'RFID Error in connecting to IPAddress:Port No'? in red. I double checked everything and it was all correct.Steve, I'm sorry to hear that the sketch is not working as expected. Let's try to debug the issue step by step.
?
First, let's make sure that the Ethernet shield is not interfering with the RFID reader. Disconnect the RFID reader and upload the following sketch to check if the Ethernet shield is working properly. #include <Ethernet.h>
?
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 1, 177);
EthernetServer server(8888);
?
void setup() {
? Serial.begin(9600);
? Ethernet.begin(mac, ip);
? server.begin();
? Serial.println("Ethernet server started.");
}
?
void loop() {
? EthernetClient client = server.available();
? if (client) {
? ? while (client.connected()) {
? ? ? if (client.available()) {
? ? ? ? char c = client.read();
? ? ? ? Serial.write(c);
? ? ? ? client.write(c);
? ? ? }
? ? }
? ? client.stop();
? ? Serial.println("Client disconnected");
? }
}
If the Ethernet shield is working correctly, you should see "Ethernet server started." on the Serial Monitor. You can also try connecting to the IP address and port using a tool like PuTTY or netcat to test the connection.
?
If the Ethernet shield is working correctly, let's try to isolate the issue with the RFID reader. Upload the following sketch to test if the RFID reader works when the Ethernet shield is connected.
#include <SPI.h>
#include <MFRC522.h>
?
const uint8_t SS_PIN = 5;
const uint8_t RST_PIN = 4;
?
MFRC522 rfid(SS_PIN, RST_PIN);
?
void setup() {
? Serial.begin(9600);
? SPI.begin();
? rfid.PCD_Init();
}
?
void loop() {
? if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
? ? Serial.print("Tag UID: ");
? ? for (uint8_t i = 0; i < rfid.uid.size; i++) {
? ? ? Serial.print(rfid.uid.uidByte[i] < 0x10 ? "0" : "");
? ? ? Serial.print(rfid.uid.uidByte[i], HEX);
? ? }
? ? Serial.println();
? ? rfid.PICC_HaltA();
? ? rfid.PCD_StopCrypto1();
? }
}
Make sure to disconnect the Ethernet shield from the Arduino Uno before uploading the sketch. After uploading the sketch, connect the Ethernet shield and test if the RFID reader works.
?
If both the Ethernet shield and the RFID reader are working correctly in isolation, there might be an issue with the combined sketch. In that case, we'll need to review the sketch further and investigate possible conflicts between the Ethernet and RFID libraries.
Please try the steps above and let me know the results. We can then proceed with the appropriate debugging steps based on your findings.
Tom |
On Tue, Apr 25, 2023 at 05:33 PM, <stephenjohnson500@...> wrote:
Okay, so I tried the latest sketch modified for four readers. Well it uploaded okay and the Serial Monitor started with a train of '.' then 'Connected to SSID'? and on a new line 'IP Address: IP'. My router sees the WeMos and correctly reports the IP address.?? Steve, ? // Import Libraries
#include <ESP8266WiFi.h>? // WeMos D1R2 ESP8266 WiFi library?
#include <SPI.h>? // SPI library for communicating with the MFRC522 reader
#include <MFRC522.h>? // MFRC522 library for reading RFID cards
?
// Wi-Fi credentials
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
WiFiServer server(80);
?
// Define the SS (Slave Select) and RST (Reset) pins for each reader
const uint8_t SS_Pins[] = {D0, D1, D2, D5};
const uint8_t RST_Pins[] = {D6, D7, D8, D3};
const int numPossibleReaders = sizeof(SS_Pins) / sizeof(SS_Pins[0]);
?
struct RFIDReader {
? MFRC522 mfrc522;
? byte id;
? byte nuid[5];
? uint8_t ssPin;
? uint8_t rstPin;
};
?
RFIDReader readers[numPossibleReaders];
WiFiClient client;
?
void setup() {
? Serial.begin(115200);
? SPI.begin();
? WiFi.begin(ssid, password);
?
? while (WiFi.status() != WL_CONNECTED) {
? ? delay(500);
? ? Serial.print(".");
? }
?
? Serial.println("");
? Serial.print("Connected to ");
? Serial.println(ssid);
? Serial.print("IP address: ");
? Serial.println(WiFi.localIP());
? server.begin();
?
? for (uint8_t i = 0; i < numPossibleReaders; i++) {
? ? readers[i].ssPin = SS_Pins[i];
? ? readers[i].rstPin = RST_Pins[i];
? ? readers[i].id = readers[i].ssPin;
? ? readers[i].mfrc522 = MFRC522(readers[i].ssPin, readers[i].rstPin);
? ? readers[i].mfrc522.PCD_Init();
? ? readers[i].mfrc522.PCD_SetAntennaGain(readers[i].mfrc522.RxGain_max);
? }
}
?
unsigned long counter = 0;
const unsigned long heartbeatInterval = 5000; // 5 seconds
unsigned long lastHeartbeat = 0;
?
void loop() {
? WiFiClient client = server.available();
?
? if (client) {
? ? for (uint8_t i = 0; i < numPossibleReaders; i++) {
? ? ? if (readers[i].mfrc522.PICC_IsNewCardPresent() && readers[i].mfrc522.PICC_ReadCardSerial()) {
? ? ? ? for (uint8_t j = 0; j < readers[i].mfrc522.uid.size; j++) {
? ? ? ? ? readers[i].nuid[j] = readers[i].mfrc522.uid.uidByte[j];
? ? ? ? }
?
? ? ? ? byte checksum = readers[i].nuid[0];
? ? ? ? for (uint8_t j = 1; j < 5; j++) {
? ? ? ? ? checksum ^= readers[i].nuid[j];
? ? ? ? }
?
? ? ? ? // Debugging output for Serial Monitor
? ? ? ? Serial.print("Reader ID: ");
? ? ? ? Serial.print(readers[i].id);
? ? ? ? Serial.print(", Card UID: ");
? ? ? ? for (uint8_t j = 0; j < 5; j++) {
? ? ? ? ? if (readers[i].nuid[j] < 0x10) {
? ? ? ? ? ? Serial.print("0");
? ? ? ? ? }
? ? ? ? ? Serial.print(readers[i].nuid[j], HEX);
? ? ? ? }
? ? ? ? if (checksum < 0x10) {
? ? ? ? ? Serial.print("0");
? ? ? ? }
? ? ? ? Serial.println(checksum, HEX);
?
? ? ? ? client.write(readers[i].id);
? ? ? ? for (uint8_t j = 0; j < 5; j++) {
? ? ? ? ? client.print(readers[i].nuid[j] < 0x10 ? "0" : "");
? ? ? ? ? client.print(readers[i].nuid[j], HEX);
? ? ? ? }
? ? ? ? client.print(checksum < 0x10 ? "0" : "");
? ? ? ? client.print(checksum, HEX);
?
? ? ? ? client.write(0x0D); // CR
? ? ? ? client.write(0x0A); // LF
? ? ? ? client.write('>'); // ETX replaced by '>'
?
? ? ? ? readers[i].mfrc522.PICC_HaltA();
? ? ? ? readers[i].mfrc522.PCD_StopCrypto1();
? ? ? }
? ? }
?
? ? // Send a heartbeat message
? ? unsigned long now = millis();
? ? if (now - lastHeartbeat > heartbeatInterval) {
? ? ? lastHeartbeat = now;
? ? ? client.write('*');
? ? ? client.write(0x0D); // CR
? ? ? client.write(0x0A); // LF
? ? }
? }
} Tom |
Locked
Re: Won't start JMRI 5 and Java11
Ken, Post the session.log content from a PanelPro session. ?That will provide information on your profile setup. Dave Sand ----- Original message ----- From: Kendal Longe <mmrailway@...> Subject: Re: [jmriusers] Won't start JMRI 5 and Java11 Date: Tuesday, April 25, 2023 6:18 PM Dave, i deleted the Java 11 that I downloaded from Oracle and downloaded an installed Java 11 from Azul and all is good on the startup. I have noticed that the panel does load up in Decode Pro. What should I do to get my profiles in order? Thanks for your help Ken |
Locked
Re: How to change the systemName of a turnout or block in a script?
#scripting
I clicked the "Reply to Group" button while still proof reading.
The steps described in the previous note will work for Blocks too, except that the added Blocks will not be required to have DCC hardware addresses, but could mimic that format if desired.?? Cliff |
Locked
Re: How to change the systemName of a turnout or block in a script?
#scripting
Steve, Blocks don't have connection based system names, they are internal. ?However, blocks do need occupancy sensors. ?A recent PR added the "AnyRailBuildBlockSensorList.py" script. For the turnouts, you need to figure out how to map the AnyRail generate internal turnout to your real turnout. ?Once the mapping has been defined it should be possible to manipulate the JMRI tables. ?Parsing the xml file can be problematic since the turnouts are grouped by connection type. Dave Sand ----- Original message ----- From: Steve Todd <mstevetodd@...> Subject: [jmriusers] How to change the systemName of a turnout or block in a script? Date: Tuesday, April 25, 2023 8:48 PM I'm working on a script to enhance the layout editor file exported by AnyRail. I can easily set the userNames as I like, but I'd like to be able to change/replace the systemName of Turnouts and Blocks to match up with my hardware. Of course, I want to do this without losing the layout connectivity. Any suggestions for how to code this? --SteveT |
Locked
Re: How to change the systemName of a turnout or block in a script?
#scripting
Steve,
What is described here works well for small layouts, but can be painful for a lot of Turnouts or Sensors and even more so for Blocks, since Blocks do not have any hardware or DCC addresses.? The same steps will probably work with some modification for LCC hardware addresses, but there are details that I cannot verify for that issue. Only the steps for Sensors are given here, since the simple replacement of the word Turnouts will suffice:
Cliff in Baja SoCal |
Locked
How to change the systemName of a turnout or block in a script?
#scripting
I'm working on a script to enhance the layout editor file exported by AnyRail.
I can easily set the userNames as I like, but I'd like to be able to change/replace the systemName of Turnouts and Blocks to match up with my hardware. Of course, I want to do this without losing the layout connectivity. Any suggestions for how to code this? --SteveT |
Locked
Re: qsi message
QSI work fine on small layouts.
IF you have several and no issues, they are fine. On large club layouts, we had lots of issues. (Including trouble reading on digitraxx programming track, and decoder scrambled when another user shorted. Your experience may vary. -- --- Thomas DeSoto, TX |
Locked
Re: Occupancy detection
#digikeijs
Which detection method does these detectors user?
I had photoresistors not work on half of the layout due to light types.? -- --- Thomas DeSoto, TX |
Blair, Nick
I think it highly unlikely that this is a power problem. The Uno with just one MFRC522? connected doesn't read the tags with either Ethernet sketch, with or without the shield. The same Uno and reader are absolutely fine with the Serial sketch. To me, it points to something in the sketch. Steve |
Locked
Re: Won't start JMRI 5 and Java11
Dave, i deleted the Java 11 that I downloaded from Oracle and downloaded an installed Java 11 from Azul and all is good on the startup.
I have noticed that the panel does load up in Decode Pro. What should I do to get my profiles in order? Thanks for your help Ken |
Locked
Re: Prioritizing cars when building a train
#operationspro
On Tue, Apr 25, 2023 at 02:51 PM, <jmri@...> wrote:
Hello,Tom,? As you may have discovered, you can assign priority to any custom load you have set up.? The program will consider any car with medium or high priority before it tries to moves a car with a low priority load.? The low load priority is the default setting and must be changed to execute this ranking of car loads.? Also, be aware that this applies to the load and NOT the car-type, so it can be used for different scenarios like keeping the priority of an empty reefer at medium rather than low, as may be the case for other non-time critical cars (think coal hoppers). Happy to help, hope it helps, <Pete Johnson> |
Locked
Re: Question about JMRI operations
#operationspro
I do mean the Buld report,? but you can dial down the number of pages if you lower the route detail to the middle detail (check the middle of the three choices).? Also reset the font size to minimum of 7 for the report.
All this is found under the Trains Window--->Tools--->Build Report Options... This will make the report shorter but still provide enough detail to help with your issue.? You can save it all as a PDF then just attach that to a reply here in the forum. Happy to help, hope it helps, <Pete Johnson> |
开云体育Stephen Nicholas may have hit upon something.? What are you powering all this with?? I spend time on the Arduino forum, and people have a lot of problems running much gear while depending on the regulator in the Uno for 5V.? Just checking. Blair On 2023-04-25 18:24, nicholas murphy
via groups.io wrote:
Hi, |
Hi,
Power problems with USB connections will depend on the current consumption of the Arduinos and any RFID modules that may be powered directly from them. I've found JMRI is happy with the two types of RFID system I've tried connected at the same time to MERG CBUS even thought one was MERG CANRC522 4 bytes user data and one was StaRFIshRail 5 byte UID. Regards Nick |
MFRC522, Uno, Ethernet and Serial
Tom I uploaded the latest sketch and tried it first with just the Uno. Unfortunately it didn't read any tags. I then tried it with the shield added, it still didn't read any tags whether the Cat5 was plugged in or not. I then tried connecting it to JMRI and it continually refused the connection stating 'RFID Error in connecting to IPAddress:Port No'? in red. I double checked everything and it was all correct. Just to make sure the Uno and Reader were working, I removed the shield and uploaded the plain Serial sketch. The tags were read okay, so not these bits of hardware. So a bit baffled, I decided to upload the original Ethernet sketch that I call v1. It still didn't read any tags, but with JMRI it held the connection! Again, I couldn't see the shield on my router. I would have expected to see 'Wiznet' and the IP address. Perhaps you don't get Hostnames with these shields? Just in case it is the shield, I have ordered another one. You know my luck with faulty equipment! Lol! So, I tend to think the shied is actually okay. But something is wrong with both sketches inasmuch they do not read the tags. Ethernet sketch v1 does hold a JMRI connection, but seeing as the sketch isn't reading any tags anyway, I'm not surprised it don't see anything in the Reporter Table. The recent Serial/Ethernet sketch also does not read any tags, but has an error connecting to JMRI as well! So, any ideas? Steve |
Locked
Re: Prioritizing cars when building a train
#operationspro
I may have answered my own question.? Upon reading the help further I see that a custom load type can be created and the priority of that load set.? So if I created a load type called "high priority load" or something like that, and assigned that load a priority of "high", would that do the trick?
-- Tom |
to navigate to use esc to dismiss