Hey,
I'm very new to Arduino and I'm working on a project that requires me to read force sensor data from an ATI Mini40 F/T sensor into an Arduino MEGA.
I thought that it would be just as simple as reading from analog input and scaling the read value but I'm only getting zeros at the output
Some in this post said that it could only be interfaced using either RS-485 or CANbus which requires the use of an adapter module to convert the signal levels. AltSoftSerial has been recommended but that hasn't worked for me either:
https://forum.arduino.cc/t/interfacing-force-torque-sensor-with-arduino-uno/626395
Here is the AltSoftSerial documentation: AltSoftSerial - Arduino Reference
Here is my code:
#include <AltSoftSerial.h>
AltSoftSerial altSerial;
#define forcePin A0
// Declare helper variables
#define RESOLUTION 1024.0
#define MAX_READ_VAL 5.0
void setup() {
pinMode(forcePin, INPUT);
Serial.begin(9600);
}
void loop() {
int c;
float force;
unsigned long sensorValue = analogRead(forcePin);
Serial.println(sensorValue);
delay(2000);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
force = sensorValue * (MAX_READ_VAL / (RESOLUTION - 1.0)); // minus 1 to index from 0
Serial.println(force);
delay(2000);
// alternative method (not working)
// if (Serial.available()) {
// c = Serial.read();
// Serial.println(c);
// altSerial.print(c);
// }
}
Any advice would be appreciated.
Thanks,
Nubia