[Solved] Core2 Vibration Motor doesn't seem to work
-
I've tried both the core2 arduino library and UIFlow/micropython, but I cannot get the vibration motor to vibrate on my core2.
I know it's connected to pin '3' on the axp192. But I haven't been able to make it vibrate with code like setLDOEnable(3, 1), a short delay and then, setLDOEnable(3, 0).
It seems to be dead.
Turning the power LED off and on with the axp192 works ok.
I've seen one working vibration video demo on the internet but without any code.
I don't know what else to try, are there any working examples for arduino/UIFlow? -
Hello @veryalien
In
APX192::begin()
the voltages for LDO2 and LDO3 are set. However there seems to be a typo in functionSetLDOVoltage()
. AXP_ADDR (= 0x34) is used as register number instead of 0x28 as first parameter toWrite1Byte()
.Incorrect:
void AXP192::SetLDOVoltage(uint8_t number, uint16_t voltage) { voltage = (voltage > 3300) ? 15 : (voltage / 100) - 18; switch (number) { //uint8_t reg, data; case 2: Write1Byte(AXP_ADDR, (Read8bit(0x28) & 0X0F) | (voltage << 4)); break; case 3: Write1Byte(AXP_ADDR, (Read8bit(0x28) & 0XF0) | voltage); break; } }
Correct:
void AXP192::SetLDOVoltage(uint8_t number, uint16_t voltage) { voltage = (voltage > 3300) ? 15 : (voltage / 100) - 18; switch (number) { //uint8_t reg, data; case 2: Write1Byte(0x28, (Read8bit(0x28) & 0X0F) | (voltage << 4)); break; case 3: Write1Byte(0x28, (Read8bit(0x28) & 0XF0) | voltage); break; } }
Cheers
Felix -
@felmue Thanks! Looking at the code you are right, I'll try overriding it later.
That was obviously VERY well tested code........
-
I changed the Arduino core2 library code and........ it still didn't work?!
Yes, I made sure that the library was really being recompiled correctly!
Still nothing, vibration motor dead?
I just had a random thought, "What if the motor is physically stuck?!".
So I tapped my core2 hard on the table a couple of times, and...... it works!!!So I actually had a double failure, software and hardware.
By the way, I tried again exactly the same UIFlow/micropython firmware with "Set vibration enable True" and now it works (so there is no problem in the micropython code)..... most of the time.
Unfortunately the motor does seem to get stuck sometimes and needs a tap to get it rotate properly. That's annoying, but it's not dead.
Perhaps the default setting of 2 volts is not really enough to get the motor to always move?
-
Hello @veryalien
Sorry to hear about your troubles.
I looked into the factory test program today and got it to compile and running after enabling PSRAM, the above mentioned fix in
SetLDOVoltage()
and some cleanup of the oldWire
vsWire1
fight that seems to come back every now and then. I wished the developers could make up their mind and always useWire
for internal I2C devices. Oh well.The factory test code does something interesting regarding vibration motor voltage. During the startup sequence it is first set to 2 volts, then the motor is quickly turned on and off again and then later on it is set to 3.3 volts (not sure why though). When testing the vibration motor from within the settings menu the latter voltage is used.
Cheers
Felix