Problems with l298n board

I have a robot car and an Arduino Uno and the l298n board. They work pretty well together. Then I thought I'd try using my Microbit instead, because it has a built in compass. According to this site, the l298n takes 2.3 V and higher as logic high, so a 3 V Microbit should work. Well, it didn't work so well. It started somewhat ok, but then the motors just didn't react.

So I thought of connecting my Microbit to my Uno and let the Uno control the l298n. Since I haven't any logic level converters nor any Bluetooth stuff for the Uno, I thought of just connecting the Microbit out to the Uno analog in. If Microbit outputs a 3 or 3.3V logic high, the Uno should be able to read the voltage on an analog in pin, right?

Don't see why that wouldn't work, on Arduino:

digitalWrite(outPin, analogRead(aInPin) > 400); // about 2V

I might want digital communication between the arduino and the microbit. Would Arduino read a 3 V signal as a digital 1? In the other direction I guess it will be easier with a voltage divider dropping 5 V to 3.3 V.

The Uno reads 3.0V or more as logic high, and 1.5V or lower as logic low, assuming the Uno is
powered at 5V.

The L298 should be fine too, but note it requires Vss (logic supply) to be 5V, not 3.3V.

Yes, I'm going to let the Arduino steer the l298, while the Microbit provides compass data to the Arduino. Though...

Johan_Ha:
According to this site, the l298n takes 2.3 V and higher as logic high, so a 3 V Microbit should work.

Anyway, providing compass data from the 3.3V Microbit might get tricky. Must dig into serial communication.

So far everything works. My Arduino outputs nicely to the serial monitor compass bearings it receives through a software serial port, to which my Microbit is connected. It just now hit me that I should probably have used the voltage divider on the RX line of the Microbit.Hope I didn't burn it.

When I connect my Microbit to my Arduino and my Arduino to the l298n, everything works. But I still want the Microbit to work with the l298n directly. My guess is that the pins IN1, IN2, IN3 and IN4 on the l298n work with 3.3 V, but the ENA and ENB maybe don't work that good. Could it be that putting 3.3 V on ENA and ENB won't make the motors run full speed, since the l298n expects 5 V? Speed can be controlled with PWM on ENA and ENB. But is the receiving pin always "evening out" the PWM (say with a cap) so that it actually doesn't see any difference on a 5 V 66% PWM signal and a 3.3 V 100% PWM signal? I had hoped that the pin would treat a 3.3 V PWM exactly the same as a 5 V PWM, since the logic pins IN1, IN2, IN3 and IN4 can read everything above 2.3 V as logic high. My thought was that the pin would kind of detect the duty percentage of the PWM, not the average voltage. I guess that was a stupid thought.

More testing...

Well, I'm a bit confused now. I tried to put a potentiometer to give variable voltage (0 to 5 V) to the ENA and ENB pins of the l298n board. But it behaved like an on/off switch. At a very small interval, some 2.92 - 2.93 V, it went from off to on. I couldn't tell if there was a smooth transition from zero to full speed. Is it possible that the impedance of the ENA and ENB pins are not very high and they actually swallow some significant current? A current, that makes my pot appear like an on/off-switch? If that's the case, I still have to test adding transistors there. My 3.3 V Microbit would send its PWM to the transistor, which in turn would direct the 5 V to the ENA pin (and ENB pin, through another transistor) and all the current that the pin swallows.