Announcement

Collapse
No announcement yet.

Artisan Lubuntu Arduino compat Grove Max31850K

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Artisan Lubuntu Arduino compat Grove Max31850K

    I am trying to use Artisan and Arduino Compatible board to Roast Coffee.
    I am new to both Arduino and Artisan(use under Lubuntu 16.04.6).
    So I am trying to do very simple work first just have only the BT temp read ans send to Artisan to display and logging.

    I have successfully configure Arduino compat (Firebeetle Esp6228) and Grove 1 wire Temperature (Max31850K) to read correct temperature.
    I could not configure Artisan to read from ttyUSB0 from the Firebeetle ESP8266 though it print out on the Arduino Serial Monitor correctly.

    I read through may articles and cannot find how to config Artisan to read from ttyUSB0.
    this is the sketch I used that can display on Arduino Serial Monitor correctly.

    But I cannot config in any option with Artisan.

    #include <OneWire.h>
    #include <DallasTemperature.h>

    // Data wire is plugged into port 3 on the Arduino
    #define ONE_WIRE_BUS 3

    // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    OneWire oneWire(ONE_WIRE_BUS);

    // Pass our oneWire reference to Dallas Temperature.
    DallasTemperature sensors(&oneWire);

    void setup(void) {
    Serial.begin(115200);
    sensors.begin();
    }

    void loop(void) {
    // request to all devices on the bus
    Serial.print("Requesting temperatures...");
    sensors.requestTemperatures(); // Send the command to get temperatures
    Serial.println("DONE");

    Serial.print("Temperature for the device 1 (index 0) is: ");
    Serial.println(sensors.getTempCByIndex(0));
    }

  • #2
    G'day aimusy, have a look here https://github.com/phil-nelson/hukyroaster it's been a while since I wrote this but you should be able to adapt bits from this to do what you want (this does a bunch of other stuff to control my roaster but the basic temp stuff that you want is there too). I used named pipes for IPC between a process that read from the arduino (arduinoCommunicatory.py) and the program that you setup artisan to read temps from (artisanprog.py) to avoid blocking issues. The arduino code is in roaster.ino

    Comment


    • #3
      Thank you very much I looked at the link.
      I got problems.

      1. The ./arduinoCommunicator.py
      Traceback (most recent call last):
      File "./arduinoCommunicator.py", line 4, in <module>
      import serial
      ImportError: No module named serial

      2. I try to set Artisan to use program in device setup.
      And pick the to select "artisanprog.py"
      is that correct?
      it came up with the message
      "callprogram() received; @line 43169
      above the heading Roaster Scope.

      3. I run the my Firebeetle ESP8266 and it was printing correct temperature on
      the Arduion IDE serial monitor, this is on ttyUSB0.

      4. I test roaster.ino it has error.

      Arduino: 1.8.11 (Linux), Board: "Arduino Uno"
      ..................
      Using library AccelStepper in folder: /home/aluntu/Arduino/libraries/AccelStepper (legacy)
      Using library MAX6675_library at version 1.0.1 in folder: /home/aluntu/Arduino/libraries/MAX6675_library
      exit status 1
      'BYJ' is not a member of 'AccelStepper'
      ========================

      Please suggest direction please.

      Thank you very much for your effort.
      Last edited by aimausy; 6th February 2020, 03:30 AM.

      Comment


      • #4
        Originally posted by aimausy View Post
        1. The ./arduinoCommunicator.py
        Traceback (most recent call last):
        File "./arduinoCommunicator.py", line 4, in <module>
        import serial
        ImportError: No module named serial
        You need to install the pyserial python module, in your case:

        sudo apt-get install python3-serial

        Though you are using a very old version of lubuntu so it might not be python3, maybe just python-serial

        Originally posted by aimausy View Post
        2. I try to set Artisan to use program in device setup.
        And pick the to select "artisanprog.py"
        is that correct?
        Yes

        Originally posted by aimausy View Post
        it came up with the message
        "callprogram() received; @line 43169
        above the heading Roaster Scope.
        Can't remember if I see this but that doesn't look like an error message so probably ok

        Originally posted by aimausy View Post
        4. I test roaster.ino it has error.

        Arduino: 1.8.11 (Linux), Board: "Arduino Uno"
        ..................
        Using library AccelStepper in folder: /home/aluntu/Arduino/libraries/AccelStepper (legacy)
        Using library MAX6675_library at version 1.0.1 in folder: /home/aluntu/Arduino/libraries/MAX6675_library
        exit status 1
        'BYJ' is not a member of 'AccelStepper'
        ========================
        Sounds like you've got a different version of AccelStepper. You don't need this though, that is for a motor I have to control the gas on my roaster so you can remove all bits to do with that. Also your thermocouple chip is different to mine, I don't think MAX6675 is going to work for you. You should replace the bits where I am reading temperature with similar from your code above which is why I said you need to adapt it to your setup.

        As you said you're new to this it'll really help if you understand the concepts of what's going on here rather than just copy/pasting and hoping it works. It'll be a bit of a learning curve but you'll know how to fix it when things go wrong and you'll learn a lot you can apply to other things. As a start, you need to understand that artisan isn't going to open the serial device (/dev/ttyUSB0 in this case) for you and communicate with your arduino directly. This is what the arduinoCommunicator.py and artisanprog.py are for. Artisan will run the program you specify every time it wants to know the temperature (e.g every second or however long it's configured). When it does this it blocks as it doesn't do this in a different thread, so this external program needs to output the temp and immediately quit, otherwise artisan will appear to be frozen. As I didn't think having the program open/communicate/close the serial device every time temp was requested was nice, I made arduinoCommunicator.py which you should run before starting artisan. artisanprog.py communicates with arduinoCommunicatory.py (via named pipes) to get the temp, outputs it to stdout and quits immediately.

        Comment


        • #5
          **********
          You need to install the pyserial python module, in your case:

          sudo apt-get install python3-serial
          [sudo] password for aluntu:

          Reading package lists... Done
          Building dependency tree
          Reading state information... Done
          python3-serial is already the newest version (3.0.1-1).
          0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

          ==========> resulted in the same error

          *************** BUT *****************
          Though you are using a very old version of lubuntu so it might not be python3, maybe just python-serial
          ===========> lubuntu 16.04.6

          sudo apt-get install python-serial

          Reading package lists... Done
          Building dependency tree
          Reading state information... Done
          python-serial is already the newest version (3.0.1-1).
          0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

          ===> it worked. no more error.
          ***************
          I am getting close now to success I think.
          More different orders
          *****************
          execute this ./arduinoCommunicator.py
          and the print out "USB2.0-Serial found at /dev/ttyUSB0" and just stay there forever.
          --------------------------->
          ./arduinoCommunicator.py
          USB2.0-Serial found at /dev/ttyUSB0

          -------> and if I run Artisan or at/in terminal "./artisanprog.py" it produced 2 more lines
          got line!
          Got command: 'TMP:0'

          and Artisan will freeze
          ---------------------
          if I Control C, in the terminal, it produces
          ^CTraceback (most recent call last):
          File "./arduinoCommunicator.py", line 77, in <module>
          parseCmd(reader.readline())
          File "./arduinoCommunicator.py", line 53, in parseCmd
          fifoSend(readFromArduino().strip() + ',' + readkPa() + ',0.0\n')
          File "./arduinoCommunicator.py", line 29, in readFromArduino
          l = arduino.readline()
          File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 481, in read
          ready, _, _ = select.select([self.fd], [], [], timeout)
          KeyboardInterrupt

          ===============
          ********quote from yours
          ..........
          As I didn't think having the program open/communicate/close the serial device every time temp was requested was nice, I made arduinoCommunicator.py which you should run before starting artisan. artisanprog.py communicates with arduinoCommunicatory.py (via named pipes) to get the temp, outputs it to stdout and quits immediately.[/QUOTE]
          =======> it freeze ===> I could not understand your last instruction above????
          sorry what I should do.

          Thank you very much

          Comment

          Working...
          X