I need help in creating a self balancing car (code)

I can think of some ways with ir/sonar to trigger the tip.. Without the sensitivity of an IMU it will be janky, could be the fun/challenge of it though. Plus driving with the phone (web deviceorientation?) gives some valuable manual control.

im interested in the ir part can u elaborate more

I was thinking lidar, point one in each direction, zero them balanced and compare to adjust.

With just IR, you could hang it from one side, and hang the sensor on the other side, calibrate zero where it is balanced and they are level. Then when it tips, the IR is broken so you can correct. That might be easier with two sensors stacked so you can tell which way it is tipping.

If that makes sense. Some gravity based physical switch of some kind would also work, dangle something straight down, with a contact on either side of it to trigger on tip.. You could have 2 or 3 dangly switches to catch different degrees of tilt.

thats smart might try it if i give up on the accelerometer

You would want both I think, the problem with the accelerometer alone is it doesn't really report the tilt, so you need some trigger to catch actual tilt. I think I like the gravity driven switch with a contact on either side the best.

idk, get something started and come back we'll work on the code ;p

That's about the time when those devices ware popular. 15 years later you still can't beat physics.

"... that was wrong in the first place and regurgitated by AI a hundred thousand times" ;p
Can't fix wrong, and AI doesn't know jack about squat.

Beginners are cooked, there is no search path to real info about any legacy stuff anymore. They (proprietors of SEO in this case, and everyone making [$] with closed source) don't want anybody able to recreate what they stumbled into. Better learn to love documentation, or being 30 layers higher in the stack than you should be, and neutered.

Then let me type it for you:

try to follow

have you looked at this article: [Arduino Self-Balancing Robot]
(https://www.instructables.com/Arduino-Self-Balancing-Robot-1/)

suggests all you need is a gyro input

You can't integrate gyro to get angle. Remember that pesky " + C" ... that is missing in the equation?

to follow what?

thanks man if ur on the arduino discord server maybe we can get in touch there