Debug: Database connection successful Cokoini CKK0017 Robot Information Support Links / Science, Technology, and Astronomy / New Mars Forums

Announcement

Announcement: This forum is accepting new registrations via email. Please see Recruiting Topic for additional information. Write newmarsmember[at_symbol]gmail.com.

#1 2026-07-12 11:51:26

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 26,109

Cokoini CKK0017 Robot Information Support Links

This topic is intended to be exclusively about the Cokoino CKK0017.  We have numerous other topics about robotics, so it would be best if this topic can focus upon this particular STEM kit.  Mars Society is in the Education business, and the Society has sponsored some college level robotics competition. For details on those, please see the extensive history recorded at marssociety.org.

this topic is created to support what I hope will be a growing community of young people (and perhaps a few older ones) who have received a CKK0017 kit as a gift, and would like to see what others are doing.

As we open this new topic, we are under review by the Cokoino company to see if we might be helpful to them in support of their customers.

At the same time, we have enlisted two educators who are interested in the potential of the CKK0017 kit for their student programs.

The ongoing project to be reported here is based upon the CKK0017 platform, with the additional feature that the control systems are being translated in real time for control of a completely different robot, made by a completely different company.

The target machine is a LynxMotion AL5D, which uses an ASCII language for control. The language used by LynxMotion may be a subset of a larger industrial language called ROS, but i am not clear on that point in mid-July 2026.

(th)

Offline

Like button can go here

#2 2026-07-12 11:52:34

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 26,109

Re: Cokoini CKK0017 Robot Information Support Links

this post is reserved for an index to posts that may be contributed by NewMars members.

Index:
Post #3: Update of Cokoino CKK0017 Arduino sketch version 23

(th)

Offline

Like button can go here

#3 2026-07-12 11:54:28

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 26,109

Re: Cokoini CKK0017 Robot Information Support Links

This post contains an update of the Arduino sketch for Cokoino CKK0017 #23

// CokoinoV23.ino Prepared by Gemini Supervised by Tom Hanson
// Version 23: Added Left Stick (L3) Steering Brake & Analog Transmission Pipe
// Version 22: Added ButtonReleased tokens to clear Python command locks
// Version 21: Complete digital button mapping & fixed setup version string

#include <PS2X_lib.h>
#include <Adafruit_NeoPixel.h>

#define LED_PIN A1
#define LED_COUNT 4
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

PS2X ps2x;
int error = 0;
bool steeringBrake = true; // True = Joysticks locked, False = Joysticks live

void setLEDs(uint32_t c) {
  for(int i=0; i<LED_COUNT; i++) strip.setPixelColor(i, c);
  strip.show();
}

void transmitToken(String token) {
  // Set LEDs to Yellow immediately to signal event registration
  setLEDs(strip.Color(255, 150, 0)); 
  
  // Send the clean token down the pipe to Python
  Serial.println(token);
  
  // Hold briefly for visual feedback
  delay(60); 
  
  // Return to appropriate background color
  if (!steeringBrake) {
    setLEDs(strip.Color(0, 150, 255)); // Cyan indicates "Steering Live"
  } else {
    setLEDs(strip.Color(0, 255, 0));   // Green indicates standard standby
  }
}

void setup(){
  Serial.begin(9600);
  strip.begin();
  strip.setBrightness(40);
  strip.show(); 

  // Cokoino onboard dedicated PS/2 pins
  error = ps2x.config_gamepad(10, 12, 11, 13);
  if(error == 0) Serial.println("V23 Ready: Visual Chatter Token Pipe.");
}

void loop(){
  if(error != 0) return;
  
  // Read gamepad options: (false = no pressure sensitivity, true = analog mode active)
  ps2x.read_gamepad(false, 0);

  // ==========================================================================
  //  ZONE 1: TOGGLE LOCK & ANALOG STEERING ENGINE
  // ==========================================================================
  
  // Test the Left Thumbstick Click (Switch) to toggle the Steering Brake
  if(ps2x.ButtonPressed(PSB_L3)) {
    steeringBrake = !steeringBrake;
    if(steeringBrake) {
      transmitToken("STEERING BRAKE ENGAGED");
    } else {
      transmitToken("STEERING BRAKE RELEASED");
    }
  }

  // Only stream analog stick values down the pipe if the operator has released the brake
  if (!steeringBrake) {
    int lx = ps2x.Analog(PSS_LX);
    int ly = ps2x.Analog(PSS_LY);
    
    // Dead-zone check: Only transmit if stick moves away from nominal center (128)
    if (abs(lx - 128) > 15) {
      Serial.print("ANALOG:LX:");
      Serial.println(lx);
    }
    if (abs(ly - 128) > 15) {
      Serial.print("ANALOG:LY:");
      Serial.println(ly);
    }
  }

  // ==========================================================================
  //  ZONE 2: DIGITAL TRANSMISSION PIPE
  // ==========================================================================
  
  // Geometric Buttons - Presses & Releases
  if(ps2x.ButtonPressed(PSB_TRIANGLE))  transmitToken("TRIANGLE");
  if(ps2x.ButtonReleased(PSB_TRIANGLE)) transmitToken("TRIANGLE RELEASED");
  if(ps2x.ButtonPressed(PSB_CIRCLE))    transmitToken("CIRCLE");
  if(ps2x.ButtonReleased(PSB_CIRCLE))   transmitToken("CIRCLE RELEASED");
  if(ps2x.ButtonPressed(PSB_CROSS))     transmitToken("CROSS");
  if(ps2x.ButtonReleased(PSB_CROSS))    transmitToken("CROSS RELEASED");
  if(ps2x.ButtonPressed(PSB_SQUARE))    transmitToken("SQUARE");
  if(ps2x.ButtonReleased(PSB_SQUARE))   transmitToken("SQUARE RELEASED");

  // Navigation / Control Buttons
  if(ps2x.ButtonPressed(PSB_START))     transmitToken("START Sketch Version V23");
  if(ps2x.ButtonPressed(PSB_SELECT))    transmitToken("SELECT");
  if(ps2x.ButtonReleased(PSB_SELECT))   transmitToken("SELECT RELEASED");

  // Directional D-Pad - Presses & Releases
  if(ps2x.ButtonPressed(PSB_PAD_UP))     transmitToken("PAD UP");
  if(ps2x.ButtonReleased(PSB_PAD_UP))    transmitToken("PAD UP RELEASED");
  if(ps2x.ButtonPressed(PSB_PAD_DOWN))   transmitToken("PAD DOWN");
  if(ps2x.ButtonReleased(PSB_PAD_DOWN))  transmitToken("PAD DOWN RELEASED");
  if(ps2x.ButtonPressed(PSB_PAD_LEFT))   transmitToken("PAD LEFT");
  if(ps2x.ButtonReleased(PSB_PAD_LEFT))  transmitToken("PAD LEFT RELEASED");
  if(ps2x.ButtonPressed(PSB_PAD_RIGHT))  transmitToken("PAD RIGHT");
  if(ps2x.ButtonReleased(PSB_PAD_RIGHT)) transmitToken("PAD RIGHT RELEASED");

  // Shoulder Bumper Commands - Presses & Releases
  if(ps2x.ButtonPressed(PSB_L1))        transmitToken("TOOL ADVANCE");
  if(ps2x.ButtonReleased(PSB_L1))       transmitToken("TOOL ADVANCE RELEASED");
  if(ps2x.ButtonPressed(PSB_L2))        transmitToken("TOOL RETRACT");
  if(ps2x.ButtonReleased(PSB_L2))       transmitToken("TOOL RETRACT RELEASED");
  if(ps2x.ButtonPressed(PSB_R1))        transmitToken("READY POSITION");
  if(ps2x.ButtonReleased(PSB_R1))       transmitToken("READY POSITION RELEASED");
  if(ps2x.ButtonPressed(PSB_R2))        transmitToken("SYSTEM HOME");
  if(ps2x.ButtonReleased(PSB_R2))       transmitToken("SYSTEM HOME RELEASED");

  if(ps2x.ButtonPressed(PSB_R3))        transmitToken("STICK CLICK RIGHT");
  if(ps2x.ButtonReleased(PSB_R3))       transmitToken("STICK CLICK RIGHT RELEASED");

  // ==========================================================================
  //  ZONE 3: PYTHON INCOMING LIGHTING LISTENER
  // ==========================================================================
  if (Serial.available() > 0) {
    String rcved = Serial.readStringUntil('\n');
    rcved.trim();
    
    if (rcved.startsWith("LED:LOCK:")) {
      char hexChar = rcved.charAt(9);
      int count = (hexChar >= 'A') ? (hexChar - 'A' + 10) : (hexChar - '0');
      strip.clear();
      if (count & 1) strip.setPixelColor(0, strip.Color(255, 0, 0)); 
      if (count & 2) strip.setPixelColor(1, strip.Color(255, 0, 0)); 
      if (count & 4) strip.setPixelColor(2, strip.Color(255, 0, 0)); 
      if (count & 8) strip.setPixelColor(3, strip.Color(255, 0, 0)); 
      strip.show();
    }
    else if (rcved == "LED:STATE:GREEN") {
      steeringBrake = true; // Force default lock state on active handshake
      setLEDs(strip.Color(0, 255, 0)); 
    }
    else if (rcved == "LED:VER:SUCCESS") {
      for(int i = 0; i < 3; i++) {
        setLEDs(strip.Color(0, 0, 0)); delay(100);
        setLEDs(strip.Color(0, 255, 0)); delay(100);
      }
    }
    else if (rcved == "LED:VER:FAULT") {
      for(int i = 0; i < 3; i++) {
        setLEDs(strip.Color(0, 0, 0)); delay(100);
        setLEDs(strip.Color(255, 0, 0)); delay(100);
      }
    }
  }
  
  delay(40);
}

This version implements changes to support readout of the left Toggle in order to control the base of the LynxMotion as well as the first arm (shoulder).

(th)

Offline

Like button can go here

Board footer

Powered by FluxBB