PowerNodeNG

Uit MakerSpace Leiden
Ga naar: navigatie, zoeken


Nieuwe generieke power nodes; gemaakt door HansB.

Not yet fully documented, https://github.com/Hans-Beerman/NodeStandard.

In use at the NodeVoordeur, NodeMetal and NodeBandsaw.

IMPORTANT

USB Galvanic Isolator/Separator

The Olimex POE is not galvanically isolated. So it is essential to use a USB condom/galvenic separator when it is connected both to Ethernet and USB. As otherwise there is a voltage delta of 48 or 2x72V between your laptops earth.

Bring up

Scripts to help debugging/testing a new board being build

Serial check

   void setup() {
     Serial.begin(115200);
   
     // Required to flush/empty any cruft/different baud-rate during programming.
     //
     while (!Serial) {
       Serial.println();
       delay(10);
     };    
     Serial.println("\n\n" __FILE__ "\n" __DATE__ " " __TIME__);
   }
   
   // the loop function runs over and over again forever
   void loop() {
       static unsigned long lst = 0;
       if (millis() - lst > 1000) {
         lst = millis();
         Serial.println("tok");
       };
   }

i2c scanning

An I2C scan should, at least, find the RFID unit (PN532=0x24) and the i2c expander (MCP=0x20). It may find the screen (typically 0x58 or 0x60) if wired in.

   #include <Wire.h>
   
   // Correct values for https://github.com/Hans-Beerman/NodeStandard/blob/master/KiCad_Files/NodeStandard/NodeStandard.pdf
   //
   const int I2C_SDA = 13;
   const int I2C_SCL = 16;
   
   // the setup function runs once when you press reset or power the board
   void setup() {
     Serial.begin(115200);
   
     // Required to flush/empty any cruft/different baud-rate during programming.
     //
     while (!Serial) {
       Serial.println();
       delay(10);
     };
   
     Serial.println("\n\n" __FILE__ "\n" __DATE__ " " __TIME__);
   
   #define GPIOPORT_I2C_RECOVER_SWITCH             (15)
     pinMode(GPIOPORT_I2C_RECOVER_SWITCH, OUTPUT);
     digitalWrite(GPIOPORT_I2C_RECOVER_SWITCH, 0);
   
     Wire.begin(I2C_SDA, I2C_SCL /*, clock frequency */);
   };
   
   void scan_i2c()
   {
     Serial.println ();
     Serial.println ("I2C scanning (PN532=0x24, MCP=0x20)");
     byte count = 0;
   
     for (byte i = 8; i < 128; i++)
     {
       Wire.beginTransmission (i);          // Begin I2C transmission Address (i)
       if (Wire.endTransmission () == 0)  // Receive 0 = success (ACK response)
       {
         Serial.print (" - Device at address: ");
         Serial.print (i, DEC);
         Serial.print (" (0x");
         Serial.print (i, HEX);
         Serial.println (")");
         count++;
       }
     }
     Serial.print ("Found ");
     Serial.print (count, DEC);
     Serial.println (" device(s).");
   }
   
   // the loop function runs over and over again forever
   void loop() {
     {
       static unsigned long lst = 0;
       if (millis() - lst > 10 * 1000) {
         lst = millis();
         scan_i2c();
       };
     };
     {
       static unsigned long lst = 0;
       if (millis() - lst > 1000) {
         lst = millis();
         Serial.println("tok");
       };
     };
   }