Navigation

    IO Rodeo Forum

    • Register
    • Login
    1. Home
    2. HoughA
    H
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 9
    • Best 0
    • Groups 0

    HoughA

    @HoughA

    0
    Reputation
    725
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    HoughA Unfollow Follow

    Latest posts made by HoughA

    • RE: Arduino Communication

      @Will-Dickson Another question is what is the highest frequency that the Sinusoidal voltammetry can operate at?

      posted in Rodeostat
      H
      HoughA
    • RE: Arduino Communication

      Even when i have the usb serial.begin for the rodeostat nothing happens, but i can still open serial monitor and press return or send any kind of code and the rodeo stat begins reading the arduino.

      posted in Rodeostat
      H
      HoughA
    • RE: Arduino Communication

      @Will-Dickson Thats actually what i ended up doing to get it to work!

      in regards to the serial problem, i tried adding a Serial2.print("\n"); as well as Serial2.println();. Neither one is getting it to work. any other ideas?

      posted in Rodeostat
      H
      HoughA
    • RE: Arduino Communication

      @Will-Dickson Thank You!!! that did the trick. i have them both communicating. However, the rodeostat only starts to read the arduino message after i press return in the serial monitor, is there some kind of Ready or begin message its expecting?

      posted in Rodeostat
      H
      HoughA
    • RE: Arduino Communication

      @Will-Dickson Yep, i made sure of it being optimized for fast. im now just stuck at the serial communication between the two devices. i had no problem when i used a basic program between two different arduinos. Im just having problems with the Arduino and Teensy now. i triple checked to make sure the tx was connected to rx of the other and vice versa. i made sure in my arduino code that it was serial printing to serial 2 which the Rx and Tx are connected. Made sure their is a line print after each command. Am i missing something? i have a feeling ive messed up in the firmware somewhere?

      Heres the code for the arduino thats sending the command:

      #include <ArduinoJson.h>

      void setup() {

      Serial2.begin(115200);

      }

      void loop() {
      StaticJsonBuffer<200> jsonBuffer;
      JsonObject& root = jsonBuffer.createObject();
      JsonObject& root2 = jsonBuffer.createObject();

      root["command"] = "setVolt";
      root["v"] = 1;

      root.printTo(Serial2);
      Serial2.println();

      delay(1000);

      root2["command"] = "setVolt";
      root2["v"] = 0;

      root2.printTo(Serial2);
      Serial2.println();

      delay(1000);
      }

      posted in Rodeostat
      H
      HoughA
    • RE: Arduino Communication

      @Will-Dickson
      So after further investigation using Device Monitoring Studios i was able to watch what was being sent from the arduino mega and what was being received by the rodeostat as well as any error messages. the device monitoring also allows the ability to create a bridge between the 2 com ports on the computer so i could simulate if they were connected.

      My first issue i found was that the Arduino was printing a string with the command and the teensy kept responding with unable to parse JSON. so i took it as the arduino needed to to be sending a JSON command rather. so after that and re checking the bridge i was actually able to get the rodeo stat to respond. I have the Arduino sending a simple set voltage to 1V for 1 sec then return to 0v for 1 sec and repeat.

      Now, im trying again to have the Arduino connected to the Serial 1 input on the Teensy and im not having the same success as before. In the firmware i even adjusted it to read from Serial1 rather than serial. this is the only thing i changed in the firm ware (other than removing the mystr info in the .ino file).

      this is what ps_message_reciever.cpp looks like now. is there anything i should be changing?

      #include "ps_message_receiver.h"
      #include <util/atomic.h>

      namespace ps
      {
      MessageReceiver::MessageReceiver()
      { }

      void MessageReceiver::reset()
      {
          overflow_ = false;
          messageCnt_ = 0;
      }
      
      
      void MessageReceiver::readData()
      {
          while(Serial1.available() > 0)
          {
              char byte = Serial1.read();
              if (!serialBuffer_.full())
              {
                  serialBuffer_.push_back(byte);
                  if (byte == '\n')
                  {
                      messageCnt_++;
                      totalMessageCnt_++;
                  }
              }
              else
              {
                  overflow_ = true;
              }
          }
      }
      
      
      String MessageReceiver::next()
      {
          String message("");
          if (messageCnt_ > 0)
          {
              ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
              {   
                  while (!serialBuffer_.empty())
                  {
                      char byte = serialBuffer_.front();
                      serialBuffer_.pop_front();
                      if (byte == '\n')
                      {
                          break;
                      }
                      message += String(byte);
                  }
                  messageCnt_--;
              }
          }
          return message;
      }
      
      
      bool MessageReceiver::available() const
      {
          return (messageCnt_ > 0);
      }
      
      
      uint32_t MessageReceiver::getMessageCnt() const
      {
          return messageCnt_;
      }
      
      
      uint32_t MessageReceiver::getTotalMessageCnt() const
      {
          return totalMessageCnt_;
      }
      

      } // namespace ps

      posted in Rodeostat
      H
      HoughA
    • RE: Arduino Communication

      @Will-Dickson

      So ive been tinkering with the firmware and ive still had no luck. Ive simply been trying to have the arduino send a command over the serial and trying to use the serial monitor to see if it gets through.

      On the Teensy i mapped serial1 on pins 5 and 6 in roder to use the p14 header.
      Heres the code so far:

      #include "potentiostat.h"

      using namespace ps;

      SystemState systemState;
      char mystr[32];
      void setup()
      {
      Serial.begin(UsbSerialBaudrate);
      systemState.initialize();
      systemState.setTestTimerCallback(timerCallback);
      Serial1.setTX(5);
      Serial1.setRX(6);
      Serial1.begin(115200);

      }

      void loop()
      {
      Serial1.readBytes(mystr,32);
      Serial.println(mystr);
      systemState.processMessages();
      systemState.serviceDataBuffer();

      }

      void timerCallback()
      {
      systemState.updateTestOnTimer();
      }

      void serialEvent()
      {
      systemState.updateMessageData();
      }

      posted in Rodeostat
      H
      HoughA
    • RE: Arduino Communication

      In the firmware, how are commands printed/written via the usb? im looking for how id change the firmware to serial.read from the arduino mega. i see i need to set the serial1 to have pins 5,6 for Tx and Rx.

      posted in Rodeostat
      H
      HoughA
    • Arduino Communication

      Hey All,
      Is it possible to have an Arduino Mega define and continuously update the rodeostat over serial communication? Im building a PID system for hydrogen peroxide using the rodeostat. I planned on using the rodeostat to monitor the value of hydrogen peroxide then use the Mega to run the PID system (using the rodeostat as the sensor essentially), data log, and provide a user interface over a serial LCD to change set point.

      In short, how would i go about getting the rodeostat to stream the sensor data continuously?

      Any help would be much appreciated!

      posted in Rodeostat
      H
      HoughA