!!

Not Registered?

Welcome!  Please register to view all of the new posts and forum boards - some of which are hidden to guests.  After registering and gaining 10 posts you will be able to sell and buy items on our N'porium.

If you have any problems registering, then please check your spam filter before emailing us.  Hotmail users seem to find their emails in the Junk folder.


Thanks for reading,
The NGF Staff.

Author Topic: Anyone know the Arduino Nano?  (Read 1058 times)

0 Members and 1 Guest are viewing this topic.

Offline Pjlons83

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 218
  • Country: gb
  • Gender: Male
    • Awards
Anyone know the Arduino Nano?
« on: October 24, 2018, 10:24:33 PM »
Hi All,
 Some time ago I experimented with an Arduino Uno and got this speed control sketch working;

https://youtu.be/jIQbftD2hG8

From memory I powered it with 12v through the DC jack and used 12v out from the Vin pin. Iím now looking at the Nano for a micro layout ( to save space) but I canít find how to input 12v and output 12v. The Vin can be used for both in and out but I canít get my head around how.

I used this circuit but used Vin rather than 5v (iirc) ;



Any thoughts?

Thanks
Paul
Gold Hill - my rule 1, ďjust for funĒ micro layout;

Clouds Hill - My first layout currently on hold;

Offline MalcolmInN

  • Trade Count: (+1)
  • Full Member
  • ***
  • Posts: 2291
  • Country: gb
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #1 on: October 25, 2018, 02:00:23 AM »
Caveat = I have not used a Nano and be sure itis not a 3.3v version ??

I think you need to swap your breadboard wire from the 5v arduino pin to the Vin pin and (because the Nano does not have a DCjack) you need to bring 12v to the Vin pin from your psu.


So, re-drawing your pic you have the config "A" and I am suggesting you need "B"


So that you take raw 12v to your board, not the Arduino conditioned 5v (I think both the Uno and Nano do that power conditioning ?)

[ This is good because your motor draws power direct from the 12v psu and does not risk overloading the on-board Arduino regulator ]


« Last Edit: October 25, 2018, 02:15:24 AM by MalcolmInN »

Offline MalcolmInN

  • Trade Count: (+1)
  • Full Member
  • ***
  • Posts: 2291
  • Country: gb
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #2 on: October 25, 2018, 02:25:44 AM »
PS for clarity ?  :)
PPS what prf is the Arduino doing and are they (new-ish) coreless motors ?




« Last Edit: October 25, 2018, 02:35:07 AM by MalcolmInN »

Offline Pjlons83

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 218
  • Country: gb
  • Gender: Male
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #3 on: October 25, 2018, 07:04:34 AM »
Hi @MalcolmInN

Your pen drawing makes sense when I see it like that. Thankyou. (Assuming the power feed is the 2 lines off to the right that I canít see the end of?)

I believe youíre right that the board itself does the voltage regulating to make sure it has its control power maintained regardless of the input power.

Not sure what you mean by prf?? And sorry, I should have explained it better; the motor in the circuit image is replaced by my track feed. So in effect Iím using a pot to regulate power to the track.

I use arduino so rarely that even though I had it working on the uno I canít remember how. I really should write these things down!  :doh:

Regards
Paul
Gold Hill - my rule 1, ďjust for funĒ micro layout;

Clouds Hill - My first layout currently on hold;

Offline AlexanderJesse

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 291
  • Country: ch
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #4 on: October 25, 2018, 07:54:07 AM »
Maybe he refers to the frequency with which the pulse-width-modulation algorithm is working. This has to do with tha saying "modern brusshless motors can be ruined by pwm". Seems that the usual low frequencies used in pwm are not good for the brushless motors and one should use higher frequencies.

As I am also investigating in using an arduino with pwm, I am pleased to hear that one can feed that little beast with higher input voltages. I reconned I had to do the voltage split outside the arduino...
=================
have a disney day
vapour is just water and therefor clean

Offline MalcolmInN

  • Trade Count: (+1)
  • Full Member
  • ***
  • Posts: 2291
  • Country: gb
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #5 on: October 25, 2018, 08:32:27 AM »

Your pen drawing makes sense when I see it like that. Thankyou. (Assuming the power feed is the 2 lines off to the right that I canít see the end of?)

Not sure what you mean by prf??
Good morning all.
Hi Paul, yes you have the essence of my thoughts right, but it was not the best drawing I ever made ! (it was a bit like topsy, it grew as I was thinking !  :) )
So I have re-done it, the final wiring diag.,  to be clear. The red 0 and 12v is the external psu.

prf = pulse repetition frequency, in the bad old days this would be quite low (50 to 150hz ?) which is bad for new coreless motors. Best is 15kHz or higher (so that you cant hear it ! ) I am not sure if anyone has determined how fast it should be as far as the motor is concerned.
Also I am not sure how high the Arduino can go, 20kHz might be pushing it a bit ??




Online Bealman

  • Moderator
  • Trade Count: (0)
  • Full Member
  • ****
  • N Gauge Society Number: 23151
  • Posts: 15050
  • Country: au
  • Gender: Male
  • Whoops back we go
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #6 on: October 25, 2018, 08:35:23 AM »
Has the 12V got to be smooth?
Vision over visibility. Bono, U2.

Offline MalcolmInN

  • Trade Count: (+1)
  • Full Member
  • ***
  • Posts: 2291
  • Country: gb
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #7 on: October 25, 2018, 08:41:45 AM »
Depends what you mean by smooth :)
I wouldnt go sticking half-wave rect 12 into it (no big caps on the board)
but a modern-day psu (prob switch mode, high freq.) should be ok without fancy filtering.

ed. in other words - any regular Arduino capable psu rated to take the excess load of the motor.
« Last Edit: October 25, 2018, 08:43:39 AM by MalcolmInN »

Offline AlexanderJesse

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 291
  • Country: ch
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #8 on: October 25, 2018, 09:50:39 AM »
prf = pulse repetition frequency, in the bad old days this would be quite low (50 to 150hz ?) which is bad for new coreless motors. Best is 15kHz or higher (so that you cant hear it ! ) I am not sure if anyone has determined how fast it should be as far as the motor is concerned.
Also I am not sure how high the Arduino can go, 20kHz might be pushing it a bit ??

I thought I remembered something in a german forum about at least 400Hz for coreless... but a quick search on the internet gave me hits that say not below 20kHz
https://electronics.stackexchange.com/questions/287046/correct-pwm-frequency-for-motor essence: "start at 20kHz and reduce only of the controller runs too hot"
https://electronics.stackexchange.com/questions/242293/is-there-an-ideal-pwm-frequency-for-dc-brush-motors/242301 Nice explanation on what happens. essence: "low frequency is not nice to the motor but good for the controller, high frequency the opposite... used frequency is always a compromise"
https://www.reddit.com/r/AskElectronics/comments/873rdd/appropriate_pwm_frequency_for_a_brushed_coreless/ shows we have the choice between 15kHz or 31kHz... on the Arduino (in the high frequency band)
https://forum.pololu.com/t/small-motors-and-pwm-frequency/420 the guy tests out small motors... and found that lower frequency worked better for lower motor speeds
http://forum.arduino.cc/index.php?topic=173147.0 Here a guy wants to do the same as us: a modelltrain controller... essence "lower frequency better forslow departure and accelleration"

edit: correctly format the quotation
« Last Edit: October 25, 2018, 10:24:55 AM by AlexanderJesse »
=================
have a disney day
vapour is just water and therefor clean

Offline Pjlons83

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 218
  • Country: gb
  • Gender: Male
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #9 on: October 25, 2018, 10:17:20 AM »
Some good links thank you. I find with arduino that there is so much out there itís hard to find what Iím looking for (and in a language I understand).

The sketch and diagram Iím using is in Arduino for dummies which is very good. Once itís running on the pot you can use the pc to show you the output values. This way you can see what speed (or I guess ďfrequencyĒ) the train likes and then right some code to set a minimum and maximum.

For example; if the train squeals at 20% and doesnít move until 40% you can say that if itís less than 40% do nothing (rather than damage the train).
Likewise if over 80% is too fast you can say donít go higher than 80% regardless of the pot being turned above 80%

Iím probably using the wrong terminology but thatís how I understand it.
Gold Hill - my rule 1, ďjust for funĒ micro layout;

Clouds Hill - My first layout currently on hold;

Offline MalcolmInN

  • Trade Count: (+1)
  • Full Member
  • ***
  • Posts: 2291
  • Country: gb
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #10 on: October 25, 2018, 10:26:30 AM »
What if we remove the big pulses and supply the base with psudo-dc ? Then the motor wont know the prf !
(caveat = it is too early in the morning for great thoughts, so there may be a flaw ?)


Offline MalcolmInN

  • Trade Count: (+1)
  • Full Member
  • ***
  • Posts: 2291
  • Country: gb
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #11 on: October 25, 2018, 11:01:49 AM »
yes there is a flaw, we need to have a load on the o/p of the pi filter and isolate the be junction as well.


« Last Edit: October 25, 2018, 11:18:04 AM by MalcolmInN »

Offline Pjlons83

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 218
  • Country: gb
  • Gender: Male
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #12 on: October 25, 2018, 11:09:17 AM »
And now I'm properly confused.  :help:
Gold Hill - my rule 1, ďjust for funĒ micro layout;

Clouds Hill - My first layout currently on hold;

Offline MalcolmInN

  • Trade Count: (+1)
  • Full Member
  • ***
  • Posts: 2291
  • Country: gb
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #13 on: October 25, 2018, 11:20:06 AM »
filter cct updated above

Offline Pjlons83

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 218
  • Country: gb
  • Gender: Male
    • Awards
Re: Anyone know the Arduino Nano?
« Reply #14 on: October 25, 2018, 09:11:36 PM »
Thank you for trying to help @MalcolmInN  but I think Iíll just have to admit defeat and think of something else;

Psudo-dc,
O/p of the pi filter,
Be junction,
Filter cct

I genuinely have no idea what youíre taking about  ???

Iíll give the Nano a go using the same cuircuit as the Uno but with 12v instead of 5v. If nothing blows up then Iíll experiment some more. I genuinely am greatful but Iím more confused now than ever!  :sorrysign: maybe Iím trying to bite of more than I can chew!
Gold Hill - my rule 1, ďjust for funĒ micro layout;

Clouds Hill - My first layout currently on hold;

 

Please Support Us!
March Goal: £55.00
Due Date: Mar 31
Total Receipts: £65.00
Above Goal: £10.00
Site Currency: GBP
118% 
March Donations


Advertise Here
anything