ARDUINO - help and ideas thread

Indeed the button is a very good idea, didn’t think about it that way. OMG Yeah, failsafe for sure was planned. The pro minis fit very well into the nunchuck ( of course w/o the headers ), just have to cut the original PCB a bit.

you should also make sure you have fail safes for pins disconnecting.

I would test on a rc car or something before you rides… thats where my nanonrf rx/tx live…

1 Like

Which pins do you mean?

from the rx to the esc.

even if they are soldered, with vibration something come break and without watching for it it could trigger full brake/throttle. both are bad…

Yeah I had think about this a while back and I couldn’t come up anything. Once it disconnects the behaviour is completely up to the ESC so it depends what it is programmed to do. Unless anybody has any other ideas?

oh thats right lol

maybe i was thinking of something on the tx side. like a disconnected pot… those little things will get you with time…

I’ve got a dead-man switch on the transmitter so hopefully that will cover it.

I have already had to chase after my board after the throttle locked on so shall be doing my best to avoid that happening again :sweat_smile:

I was thinking of adding one but then I like to grip lightly when i’m going really slow… make sure the pot is neutral when pressed, else ignore. or add ramping and you have “launch control” :sunglasses:

I’m using an exponential moving average at the moment which smooths the throttle out nicely… until i got too cocky, jammed the throttle on full from near standstill and lent back a bit too much. :unamused:

Bit of tuning and it might be idiot proof…

Would you share your code for the throttle smoothing? I’m about to get back into my little Arduino project this weekend (work has been insane).

@JLabs I did some research when starting my project and the one thing I did learn is not to use Delays if possible. Delays stop all anything from running while the delay is active so a delay of 1000 is stopping anything from happening for a whole second. In your code you have two 1000 milisecond delays. Try just removing the delays completely and see how it goes

You only need to use the Serial library. Look up SoftwareSerial and read this https://www.baldengineer.com/when-do-you-use-the-arduinos-to-use-serial-flush.html

The hc05s are fine. I got this working with two hc05 and 2 Arduino nano

2 Likes

This is the main equation that does it (based on this):

pwm_out = (int) (smooth_factor*target_pwm) + (1-smooth_factor)*prev_pwm;

There are a few issues with it at the moment. There is a bit of a delay between getting out of neutral before the motor starts spinning. I think I might try set a minimum output pwm and see if that helps. There is also an integer rounding error which means it doesn’t ever reach maximum. With the current smoothing factor i think its max is about 1969ms pwm with a constant input of 2000

Other than that its seems to work quite well.

Hopefully this should link to the files, very much WIP but see what you think.

That is why you should always use millis() instead of delay()

Hey Arduino people. I have an idea I don’t know how to execute. I would like to make custom led patterns for under my board. I have learned of FastLED and Adafruits NeoPixel but I dont know which arduino/whoever board would be optimal to leave on the eboard to power some led’s… I would like to be able to wire up at least one button maybe 2 to cycle the led patterns and have two led strips, 1 on each side of the board. I posted in the Eskate light thread before finding this arduino thread, and I am going to create a thread for this arduino project so it doesn’t get mixed into the others…located here http://www.electric-skateboard.builders/t/arduino-controlled-led-strips-for-underglow-fastled/13689/1

just get a nano or a trinket, that should be enough to run your leds

Anyone know if its possible to replace the VESC with a arduino? I guess not since Arduino can only handle 5V.

possible? kinda. practical? not one bit.

This would literally “reinvent the wheel”

Hmmm, yes, I suppose you could build your own ESC based on an arduino.

You just need to

  • develop your logic and architecture of the controller (or steal it)
  • develop the code (or port from other implementations)
  • add a driver chip
  • some mosfets
  • current measurements for feedback loop
  • soldier everything together or develop a custom PCB
  • develop an interface to control the settings
  • do some testing
  • repeat all of the steps

Easy … :wink:

Let us know how it went

1 Like

I love these sarcastic insults.