@Kees The above finally worked with the M5StackSimpleServo library. However it turned out that I could only control speed and direction. Using degrees 0-90 for retraction and 90 - 180 for extending. It is not possible to position, this was finally confirmed by the seller. Again searching for actuators that can position.
Posts made by Kees
-
RE: Simple PWM example does not work
-
RE: Simple PWM example does not work
Tried to upload a small video to show both at work at once (with wrong extending). No privilege, not possible.
-
RE: Simple PWM example does not work
For some reason it does something now. Not really sure what made it work. It did however change the frequency to 200. Somewhere I read that that was necessary for ESP32. It seems to be working.
However, I can not position it the way I want and need it. It extracts not to the complete length of the rod (it should extract 12cm, it does about 7cm) and when retracting it keeps spinning as though it expects to retract more (that is in accordance to the not fully extending. So, anyone an idea? Something about the initial zero position and how to set this up?
Below the current 'simple' code.#include <M5Atom.h>
const int8_t linActPin1 = 33;
const int8_t linActPin2 = 23;
const int linActChannel1 = 1;
const int linActChannel2 = 2;
const int linActFreq = 200;
const int linActResolution = 8;uint8_t method;
void setup() {
Serial.println();
ledcSetup(linActChannel1, linActFreq, linActResolution);
ledcAttachPin(linActPin1, linActChannel1);
ledcSetup(linActChannel2, linActFreq, linActResolution);
ledcAttachPin(linActPin2, linActChannel2);
}void setServoPos(int8_t pos) {
ledcWrite(linActChannel1, pos);
ledcWrite(linActChannel2, pos);
}void loop() {
method = 1;
Serial.print("O");
for (int posDegrees = 0; posDegrees <= 180; posDegrees++) {
setServoPos(posDegrees);
delay(50);
}
Serial.print("I");
for (int posDegrees = 180; posDegrees >= 0; posDegrees--) {
setServoPos(posDegrees);
delay(20);
}
Serial.print("-");
} -
RE: Simple PWM example does not work
@teastain Thanks. I asked the supplier for information, but what I posted earlier was what I got. With the help you gave, some help from ChatGTP and a lot of trying and experimenting I hope to find an answer. I'll let it now here. Thanks again for the help, it is much appreciated!
-
RE: Simple PWM example does not work
@teastain Two wires go to the rod, but it seems they come from a PWM module (in the specs you can see that that is a tiny device). And that module has three wires, brown (ground I think), red (+5V perhaps), and orange (PWM wire?). I have tried different sketches also with the Arduino Library (not the right type). I did not try and did not find the ESP32 Servo Library yet.
But perhaps I blew up the rods already. I do not know how vulnerable they are. Hope to find some sign of life in it. -
RE: Simple PWM example does not work
@teastain Thanks. A few questions. The first ledcAttachPin does not apply here I presume. The math is not clear to me. 180 probably has to do with degrees, 2.000 perhaps frequency, then a 20.000.0 I do not understand, the 65536 is probably a 2 byte shift and then another number (16340 I do not understand. Perhaps you have a link to a site with some information about this.
The rods I can not reposition by hand; or actually, I do not want to use force, it does not shift easily.
The coming few days I have less time, so maybe I do not respond, this not a lack of interest, but just other things that require my attention and or time.
Thanks anyway, much appreciated.
-
RE: Simple PWM example does not work
@teastain On the controllers it says Atom Lite, nothing more. Is there another way to distinguish them, does is otherwise say Atom Lite S3?
I applied a separate power supply. This what the specs tell:- The mini electric push actuator is equivalent to a linear motor : through the red and black two power lines to provide DC power supply DC 6-7.4V to the motor rotation, and drive the telescopic rod to achieve expansion, and stroke in any position can stop, can be self-locking.
2.With PWM electric control : can be controlled by the receiver, can adjust the speed and direction.
3.PWM module parameters :
Weight:0.4g
Size:12x8.5mm
Voltage:3.5-6v
Continuing current:1A ,The biggest current: 1.5A
PWM range:1000~2000US
BEC output: No
Running direction: two-way, can be forward and reverse.
Applicable motor:Brush motor.
Maybe this is enough. I could not get it working. Except for one moment it completely expanded, however I not reverse it or achieve another position. Hope you have some advice for me.
- The mini electric push actuator is equivalent to a linear motor : through the red and black two power lines to provide DC power supply DC 6-7.4V to the motor rotation, and drive the telescopic rod to achieve expansion, and stroke in any position can stop, can be self-locking.
-
RE: Simple PWM example does not work
@All I finally added a second LED that I controlled with a digitalWrite and that worked fine (even better without the resistor used in the schematic). After playing with the connections (again) finally I saw the light (literally). I believe the contact of the pin in the Atom Lite does not make good contact (have to find something that does, otherwise quite unreliable). So this seem to work. Thank you guys for that.
However I still have a question about using it for the linear actuator. It has a three wire input. A brown one, probably ground, a red one (5V? (document states Voltage 3.5 - 6V) and an orange one (control signal). I can not find much information about connecting such a device. Tried several setups with different frequencies (1000-2000), but nothing seems to work. Maybe an external adapter is needed. Any idea how to connect it?
-
RE: Simple PWM example does not work
@teastain
The LED won't light up. However I did measure about 3.3V on the output pin before. I expected this to increase and decrease. It did not.
Now I don't have time anymore, but when have another suggestion I will try it tomorrow.
Thanks! -
RE: Simple PWM example does not work
For now a LED (but finally I hope to control a 5V linear actuator. The LED example is to experiment.
-
Simple PWM example does not work
I found a simple PWM example for the esp32 using Arduino IDE. This does not seem to work for and Atom Lite. Do I need to use another controller? Or something else missing.
This is the example:
const int ledPin = 22;
const int freq = 5000;
const int ledChannel = 0;
const int resolution = 8;void setup() {
Serial.println();
ledcSetup(ledChannel, freq, resolution);
ledcAttachPin(ledPin, ledChannel);
}void loop() {
for (int dutyCycle = 0; dutyCycle <= 255; dutyCycle++) {
ledcWrite(ledChannel, dutyCycle);
delay(25);
}
for (int dutyCycle = 255; dutyCycle >= 0; dutyCycle--) {
ledcWrite(ledChannel, dutyCycle);
delay(25);
}
Serial.print(".");
} -
RE: ENV IV Sensor with M5Atom (lite)
@teastain Thanks, this is indeed basically the same as Felmue (Felix) has and it works also.
I compared the readings with the readings from a CO2-sensor. Temperature is close to each other (difference of about max. 0.2 Celsius). But the humidity differs about 8-9%. That is a lot. The sensors are adjacent to each wonder and should not differ so much regarding humidity (compared to a mechanic sensor, the CO2 sensor comes closest (difference of about 2-3%)).
I wonder how reliable the readings really are.Thanks for the support anyway!
-
RE: ENV IV Sensor with M5Atom (lite)
Thanks Teastain (Terry) and Felmue (Felix),
Terry I am not sure what else I can tell than it is the M5Atom Lite! I would like to see your sketch. However it could basically be the same as Terry's.
Felix, thanks for your sketch. For some reason it fails on linking this: sht4x.begin(Wire, 0X44); I can not really see what is different in libraries. However I tried this: sht4x.begin(Wire). And this works well. At least I get readings that compare to the ones using another sensor (temperature and humidity). Perhaps the I2C address 0X44 is default.
Thanks both,
Kees. -
RE: ENV IV Sensor with M5Atom (lite)
@teastain Hi, I use c++ with Arduino (IDE Microsoft Visual Studio and Visual Micro) and as far as I can tell I use the Atom Lite version. A basic version that I use for home automated applications. I expect both to work with the sensor. If you can shed some light on this I'd grateful.
-
ENV IV Sensor with M5Atom (lite)
After trying several examples and combining several sketches I do not get the sensor working. In one example I get pressure, but with a large number (perhaps the order, I did not check that), not sure if it makes sense. I never succeeded in getting other values than 0 for temperature and humidity. I tried several atoms as well as several sensors. Somehow the combination of I2C:SHT40(0x44) and BMP280(0x76) should work.
Does anyone has a simple example sketch that really works?
-
RE: Atom lite does not work with OTA
Hi Felix,
Thank you very much. I did not expect this, but indeed the problem is the browser. I use Firefox as default browser (on Windows 11). I switched to MIcrosoft Edge for this and it works.
Any idea what the reason is? I presume some extra bytes transferred, but why. Or/and is it about the way the webserver handles it?It took me quite some time and could take me much more time without your solution!
Thanks again,
Kees -
Atom lite does not work with OTA
I'm trying to update my home devices (atom lites) using OTA. However the simplest OTA examples do not work. All first it seems to work fine. The webserver can be reached, a .bin can be selected but it fails somewhere in the early phase of uploading to the device with the following error: abort() was called at PC 0x40081f82 on core 1. I also tried another OTA library; the ElegantOTA with the same problem. Anyone any experience with this? And perhaps a solution?
-
RE: Atom Lite, interrupt not working as expected
Solved this finally. The Atom Lite does not seem to have a pullup or pulldown resistor. By applying a resistor the problem seems to be solved and it is possible to detect Rising, Falling and Change states.
-
Atom Lite, interrupt not working as expected
The following code does not work. The LED flickers, no matter what the signal on the used pin is. Tested on two Atoms. Also tested different mode (RISING, FALLING, CHANGE). The code is from Arduino site:
#include <M5Atom.h>
const byte ledPin = 22;
const byte interruptPin = 19;
volatile byte state = LOW;void IRAM_ATTR blink()
{
state = ~state;
}void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, FALLING);
}void loop()
{
digitalWrite(ledPin, state);
}Anyone an idea to solve this?