ARDUINO - help and ideas thread

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.

A VESC and an Arduino are two completeley different things. An arduino is just an AT chip on a breakout board.

I believe you could light up a few leds or drive a very small dc motor…like for opening a cover for you… but not really a full sized vehicle which needs to carry at least 100lbs or so :slight_smile:

Basically, I think you can look at Vedder and how much time he has spent and is still spending to create a motor controller… You can adjust / develop control mechanism… but to create the drive electronics is a bit different task… I think :wink:

Dont’ we all?

Suppose this is one of the drawbacks of this online world. Wouldn’t be so bad if we all had a beer in our hands.

I tried to be a bit more specific in my post. Yes it would be possible to replace a VESC with an arduino, It’s just a lot of work. After all arduino is the brain of many robotics projects and is a very good interface between code and the physical electronic world. And yes, arduino runs on 5V. This is why we would need mosfets and potentially a driver chip to control them. You can even buy motor driver shields, e.g. Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit [v2.3] : ID 1438 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits … up to 13,5V I’m not aware of standard shields that go up to our 42V.

So yes, if anybody is up for it, it would doable and competition would be good.

I’m trying to create my own 2.4ghz remote system using an uno, a micro, and some nRF24L01+ modules. The only problem is that I’m a complete novice with arduino so i’m having some difficulty getting anything to work.

I tried following some examples online but cant find anything specific to esk8 (outside of this forum of course).

Things I want to include: dead mans switch, potentiometer based thumb wheel, data logging on the uno, and maybe lights later on.

here’s what I have so far:

Could anyone provide a good example or tutorial on how to set these things up?

Have managed to get the modules communicating yet?

hey i just made a led blink (looks at this tread)

nope i dont know any ting

not yet. I’m beginning to think on of my solder joints on the chip is messed up, because I’ve even tried copy and pasting known working programs. Gunna have to check them over next.

Controlling the esc with the arduino is surprisingly easy on the other hand, so at least there’s some progress.

Which library are you using? I would go for the Tmrh20 rf24 library and see if you can get the print details function to return the correct information.

I had a few issues with the arduino communicating with the module to start with.

Try follow the instructions here https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo and then run the pingpair_test from the RF24 examples on just 1 arduino and see what it prints out