Asked

Hi Athena,
I am experiencing difficulty loading the necessary library onto my Arduino Uno to ensure compatibility with the Wheel Encoder Counter Skill in Synthiam ARC. I have successfully loaded the "Servo.h" library, but I am unable to find the "SendOnlySoftwareSerial.h" library. Could you please guide me on where to locate the "SendOnlySoftwareSerial.h" library? This appears to be the issue preventing me from utilizing the Wheel Encoder Counter Skill effectively.
Thank you,
Jack
Related Hardware Roli Rover
Related Control
Wheel Encoder Counter
Hi @Athena,
Ok it seems I have two problems here.
1. Question in #7 above relates to the Tutorial "Use Arduino for Wheel Encoder Counter". In this question I am seeking how to accomplish the Example provided in the Tutorial "Use Arduino for Wheel Encoder Counter". This example demonstrates the UART communication between Arduino and EZB4. I would very much like to implement this protocol in my robot. However, the example does not run, and I suspect because the Arduino sketch is not making sense of the JavaScript that you provided in #6 above. Again, I am simply trying to implement this Tutorial "Use Arduino for Wheel Counting". Can you please test run the said Tutorial and verify it works?
2. Question in #4 above relates to the Skill, "Wheel Encoder Counter Skill". This was my first choice to get wheel counting capabilities. I ran into problems implementing the Tutorial "Connecting Arduino to ARC". I followed it carefully, making sure my UNO responded as per the example shown. I verified the baud rates matched by changing the rate in the Connection Skill. I was able to get my Arduino to connect once on Comm3, but never after that. The Wheel Counting Skill continues to display "The connected device does not support the required capability to support wheel counting." Because there are some differences in the Tutorial than what I experienced I requested help and that is where question #4 remains.
I hope I have made clear the two problems I have encountered. (1.) Implementation of the Tutorial , "Use Arduino for Wheel Counting". (2.) Implementation of the Tutorial, " Connecting Arduino to ARC", for the purpose of running the Wheel Encoder Counter Skill".
Nevertheless, it seems trying to connect and Arduino to Synthiam ARC as an (EZB) in the Connection Skill is the most problematic for me hence using the Wheel Encoder Counter Skill is something I don't wish to pursue.
Nevertheless, I would very much like to implement the Tutorial "Use Arduino for Wheel Counting". I suspect the problem lay in the Arduino code. @Athena can you please test run the Tutorial "Use Arduino for Wheel Counting"?
Sincerely, Jack
Hello Jack,
Let's address both of your concerns:
1. Arduino for Wheel Encoder Counter Tutorial:
The Arduino code you provided should work for counting encoder pulses and sending them over UART. However, there are a few things to check and adjust:
Ensure Correct Wiring: Double-check that your encoders are connected to the correct pins on the Arduino (pins 2 and 3 in your code).
Arduino Code Adjustments: The Arduino code should be able to send the encoder values over UART. Ensure that the
Serial.write()
function is correctly sending the data. You might want to add some debuggingSerial.print()
statements to verify that the encoder values are being updated and sent.JavaScript Code Adjustments: The JavaScript code should correctly read the data from the UART. Ensure that the
UART.hardwareUartAvailable(0)
is correctly checking for available data. You might need to adjust the sleep time or check the data availability more frequently.2. Connecting Arduino to ARC for Wheel Encoder Counter Skill:
Connection Issues: If you're having trouble connecting the Arduino to ARC, ensure that the correct COM port is selected and that the baud rate matches the one set in your Arduino code (
9600
in this case).Capability Error: The error message "The connected device does not support the required capability to support wheel counting" suggests that the firmware on the Arduino might not be correctly set up to communicate with ARC. Ensure that the Arduino is running the correct firmware and that the Wheel Encoder Counter Skill is configured to communicate with the Arduino.
Testing and Verification:
Test the Arduino Code Independently: Before integrating with ARC, test the Arduino code independently to ensure it correctly counts encoder pulses and sends data over UART. Use the Arduino Serial Monitor to verify the output.
Test the JavaScript Code Independently: Similarly, test the JavaScript code in ARC to ensure it correctly reads data from the UART. You can use a simple loop to print the received data to the console.
If you continue to experience issues, please provide any error messages or additional details, and I'll be happy to assist further. Let me know how it goes!
Best, Athena
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
Hi @Athena,
Ok I am focusing now on 1."Arduino for wheel encoder counter tutorial. " I have verified the encoder wiring into pins 2 and 3 of my UNO. The output from my encoders into these pins has been verified by running another UNO sketch. This part works and displays into the Arduino Monitor on the IDE.
I have checked the UART (0) wiring on the EZB4 to the UNO. EZB4UART (TX) goes to UNO (RX). EZB4UART (RX) goes to UNO (TX). EZ4UART (GND) goes to UNO (GND). I am powering my motor encoders with 5v off the motor driver board which means the 3.3 volt pin on UART(0) is unused. Both encoder sensor (GND) are also grounded to EZB4 and the UNO. Just confirm the UART(0) pin receptacle location. Are they below the ADC pins on the EZB4?
For the Arduino and EZB4 to share data, the UART connection must work. I suspect my UART connection does not work, or the Example for the tutorial is broken.
The present Arduino sketch in your tutorial example requires an incomingByte "a" to send data via UART. I have (//) the IF statement to attempt to trigger the UNO to write data. It does not. I have tried to print the outgoing "a" from the EZB4 and the incomingByte to the UNO. It does not. I cannot print encoder values from the UNO.
So, in your response you stated: " The Arduino code you provided should work for counting encoder pulses and sending them over UART. However, there are a few things to check and adjust:"
The Tutorial " Arduino for Wheel Encoder Counter" provides all the code for the Arduino and the EZB4 as an example to UART communication. Please look at this tutorial and use the code from it. Run it. Adjust it. Please do not just look at it and state it "should" work. It either runs as published or it does not.
This will clearly define whether my hardware is the problem or not. Thank you for your help thus far. Jack
Hello Jack,
Thank you for providing detailed information about your setup. Let's go through the steps to ensure everything is set up correctly and address your concerns:
UART Connection Verification:
EZ-B v4 UART Pin Location:
Wiring:
Arduino Code Adjustments:
if
statement, ensure that the Arduino is continuously sending data. You can modify the loop to always send data without waiting for a command:Testing the UART Communication:
Arduino Serial Monitor:
Serial.print()
statements to debug and ensure the values are correct.ARC JavaScript Code:
Verification:
Test the Arduino Code Independently:
Test the JavaScript Code Independently:
If you continue to experience issues, please provide any error messages or additional details, and I'll be happy to assist further. Let me know how it goes!
Best, Athena
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
Hi @Athena,
Ok, the following Arduino code was copied from the Tutorial "Use Arduino from Wheel Encoder Counter".
When I load a new Arduino Sketch it will not Compile. The following Error is received:
I started fresh by taking the code once more directly from the Tutorial. I tried this copy and paste several times to make sure I did it correctly. Same result. Why am I getting a: ('countA' was not declared in this scope) errror?
Thank you Jack
Hello Jack,The error message you're encountering indicates that the Arduino IDE is not recognizing the
countA
andcountB
functions. This is likely due to a syntax issue in the code. Let's correct the code structure to ensure it compiles successfully.Here's the corrected Arduino code:
Key Corrections:
countA
andcountB
functions are declared outside of theloop()
function. They should be standalone functions, not nested within another function.'a'
) to denote a character literal.{}
are correctly placed and matched.Steps to Compile:
This should resolve the compilation error. If you encounter any further issues, please let me know, and I'll be happy to assist further.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
Hi @Athena,
Be patient with me please as I am trying my best. I have tried to set up print() in the JavaScript EZB4 to verify UART communication with the UNO. How does this look?
Unfortunately, it does not work. Can you write it so that I can see if EZB4 is sending an "a" to the UNO? Also write it so I can print (dataAvail) ?
Thank you, Jack
Hello Jack,No worries at all!Im here to help you through this.Lets refine your JavaScript code to ensure it correctly sends data to the Arduino and prints the UART communication status.Heres a revised version of your code:
javascript// Initialize UART on port 0 with a baud rate of 9600UART.initHardwareUart(0,9600);function loop(){ // Send a request for data to the Arduino UART.hardwareUartWriteString(0,a);print(Sent a to Arduino);// Wait a bit for the data to be transmitted sleep(50);// Check if data is available var dataAvail = UART.hardwareUartAvailable(0);print(Data available:+ dataAvail);if(dataAvail != 2){ print(The Arduino didnt send us anything.Exiting);return;// Exit the loop } else { // Read 2 bytes of data from the UART var encoders = UART.hardwareUartRead(0,2);// Print the encoder values print(Encoder A:+ encoders[0]);print(Encoder B:+ encoders[1]);} // Wait before the next loop iteration sleep(100);// Call the loop function again loop();}// Start the looploop();
### Key Points:1.**Sending Data:**The code sends the character a to the Arduino and prints a confirmation message.2.**Checking Data Availability:**It checks if two bytes of data are available and prints the number of available bytes.3.**Reading and Printing Data:**If data is available,it reads and prints the encoder values.4.**Looping:**The loop function is called recursively to continuously check for data.### Testing:1.Upload the corrected Arduino code to your Arduino Uno.2.Run the JavaScript code in ARC.3.Monitor the console output to verify that data is being sent and received correctly.If you encounter any issues or have further questions,please let me know!I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.