I am currently about to invest in acquiring the gear to convert my stock to radio control and had my heart set on the Deltang system. This throws an interesting spanner in the works.
Thanks for your work on this. I must admit to being a belt and braces sort of guy and so, although the li ion pack is nominally rated at 11.1v, when it is fully charged it can exceed 12v, hence the voltage regulator. I wondered if I could use the 5v terminal on the L298 but being new to all this, I wasn't sure.Corrected diagram,....Bluetooth Power moved from D3....to 5V pin...., resistor voltage divider for correct 3.3V logic level.
Nano will accept up to 12V on it's VIN pin....voltage regulator surplus to requirements.
View attachment 254153
Or, as the Input Voltage is less than 12V, can move jumper on L298 for 5V to supply power to the Nano on the 5V pin.
View attachment 254154
Interesting stuff, Michael. I've been tinkering with the PWM frequencies on the Arduino to try and cut down motor buzz. What setting do you use?If you need to make your decision now, I would say go with Deltang until this bluetooth system is proven. I've been using Arduinos in locos outdoors since 2013 so I have a lot of experience. Picture from 2013 of Accucraft Lyn controlled by an Arduino Nano and nrf24l01 wifi board with an Arduino Uno in the 'smart' brick, as I called it
View attachment 254158
Now whilst I have no experience of bluetooth, I know that connectivity is the main issue in the garden and that whilst it might work so many metres on a bench, when you stick it in a loco, especially a metal one, it's a different matter.
The Arduino/nrf24l01 combination worked but the range was bad, 5 - 10 meters at best.
In 2018 I switched to the ESP8266 which has an integral wi-fi chip and a Tenda router and it is now working happily in my 7 locos and 2 wagons, around a track that is 70 foot long.
I would therefore say that you need to prove that this bluetooth solution works reliably in a metal loco around a large garden before investing too much time or money in it.
I have an HC-06 and many Arduino Nanos so would be more than happy to help test it if you wanted. Unfortunately, my phone is a Samsung S4 mini which is Android 4 and the app requires Android 5 and above. My wife won't be too happy if I keep using her newer phone in the garden!
My wife won't be too happy if I keep using her newer phone in the garden!
Interesting stuff, Michael. I've been tinkering with the PWM frequencies on the Arduino to try and cut down motor buzz. What setting do you use?
Trouble with that is it only gives a limited range of values it shoots up from 490Hz to 30kHz with nothing in between. I want to play around with 12kHz or 16kHz.Set PWM frequency for D9 & D10
Timer 1 divisor to 256 for PWM frequency of 122.55 Hz
TCCR1B = TCCR1B & B11111000 | B00000100;
Rik, try changing the line above in the program to one of the values below.....
TCCR1B = TCCR1B & B11111000 | B00000001; // 31KHz
TCCR1B = TCCR1B & B11111000 | B00000010; // 3.9KHz
TCCR1B = TCCR1B & B11111000 | B00000011; // 490Hz (default)
TCCR1B = TCCR1B & B11111000 | B00000101; // 30.6Hz
I wish they'd include something as straightforward as that in the Arduino coding by default. Even with the PWM library it's a bit convoluted.It depends if you want a hum or a whistle. I adjust the value for each loco as it depends on the motor. Normally I use around 5000 to 8000 Hz but interesting to see that the bluetooth example used 122.5Hz. Does anyone know what frequency Deltang uses?
As per John's post, the options are rather restrictive on an Arduino. It's a bit easier with an ESP8266: analogWriteFreq(8000);