Initial experiments with Bluetooth and Arduino
Initial experiments with Bluetooth and Arduino
Whilst away on my hols (in sunny France - and yes it was hot!!), I got to grips with the (very) basics of Arduino. Now I'm back I've been experimenting.
Still early days yet, but I've written up wot I dun on my blog for those who might be interested
https://riksrailway.blogspot.com/2019/0 ... phone.html
Total outlay on the control bits = £17.81. I could have done it more cheaply if I'd bought the bits directly from China - but I didn't want to wait.
Hope it's of interest.
Rik
Still early days yet, but I've written up wot I dun on my blog for those who might be interested
https://riksrailway.blogspot.com/2019/0 ... phone.html
Total outlay on the control bits = £17.81. I could have done it more cheaply if I'd bought the bits directly from China - but I didn't want to wait.
Hope it's of interest.
Rik
Re: Initial experiments with Bluetooth and Arduino
Hi Rik,
Glad you had a good holiday. Yes it is hot in France, we still have a few more days here before we have to return and we are only a few kilometres from where the French temperature record was set last weekend at just over 45 deg C.
Anyway, thanks for your Arduino blog, very interesting, and when I've had time to go through the detail, possibly of interest. However, a couple of quick questions first -
1) is it necessary to have a fully working smart phone for the Bluetooth side of things to function, i.e with a valid SIM card installed? The reason I ask is that I don't possess such a beastie, but cheap 2nd hand units are available and might be worth the investment as long as I don't also have to fork out for a SIM account ( what did you say about being a cheapskate??).
2) You mention the limited Bluetooth range issue, and I wonder if it might be possible to programme the Arduino to maintain whatever its current instructions are on loss of signal, and continue with them until signal is regained, similar to the Deltang operation?
Glad you had a good holiday. Yes it is hot in France, we still have a few more days here before we have to return and we are only a few kilometres from where the French temperature record was set last weekend at just over 45 deg C.
Anyway, thanks for your Arduino blog, very interesting, and when I've had time to go through the detail, possibly of interest. However, a couple of quick questions first -
1) is it necessary to have a fully working smart phone for the Bluetooth side of things to function, i.e with a valid SIM card installed? The reason I ask is that I don't possess such a beastie, but cheap 2nd hand units are available and might be worth the investment as long as I don't also have to fork out for a SIM account ( what did you say about being a cheapskate??).
2) You mention the limited Bluetooth range issue, and I wonder if it might be possible to programme the Arduino to maintain whatever its current instructions are on loss of signal, and continue with them until signal is regained, similar to the Deltang operation?
Philip
Re: Initial experiments with Bluetooth and Arduino
Hi Philip
I can't see any reason why a network free phone wouldn't work. I also use it with my tablet which is like a phone without the phone. Regarding the range. I tested it in my garden and easily got 17m with foliage in the way. That's the max I get to see from phone to loco, so it could well be more. The coding by default keeps the last value received until it detects a change from the phone so in effect has built in coast control.
Rik
I can't see any reason why a network free phone wouldn't work. I also use it with my tablet which is like a phone without the phone. Regarding the range. I tested it in my garden and easily got 17m with foliage in the way. That's the max I get to see from phone to loco, so it could well be more. The coding by default keeps the last value received until it detects a change from the phone so in effect has built in coast control.
Rik
Re: Initial experiments with Bluetooth and Arduino
It's early days so I haven't had much time for a full evaluation but what I've found so far is:
Pros
Rik
Pros
- Cheap
Flexible (I'm presently investigating a DIY app and already added directional lighting and coded auto station stop)
Acceptable range
Plenty of resources
- Hard to see the screen in sunlight
Not tactile - ie you can't feel the controls in your hand
Easy to press the wrong button and lose the app - but that might be because I'm not an experienced smart phone user
Not as compact and convenient as Deltang
Some tech knowledge required but the learning curve is quite shallow
Rik
Re: Initial experiments with Bluetooth and Arduino
Latest development.
Steve Massikker from arduinorailwaycontrol.com has been in touch and wants me to collaborate in producing an app and coding specifically to meet the needs of large scale train operation. Watch this space, as they say.
Rik
Steve Massikker from arduinorailwaycontrol.com has been in touch and wants me to collaborate in producing an app and coding specifically to meet the needs of large scale train operation. Watch this space, as they say.
Rik
- tom_tom_go
- Driver
- Posts: 4824
- Joined: Wed Feb 23, 2011 3:08 am
- Location: Kent, UK
- Contact:
Re: Initial experiments with Bluetooth and Arduino
Oh Rik what have you started, I play trains to escape technology!
As long as this type of tech doesn't render DCC and traditional Tx/Rx obsolete then it's good thing for those who want to operate using a touch screen and an app.
As long as this type of tech doesn't render DCC and traditional Tx/Rx obsolete then it's good thing for those who want to operate using a touch screen and an app.
Re: Initial experiments with Bluetooth and Arduino
I've just come back from wading through his site and I noticed that you seemed to have joined up!
Philip
Re: Initial experiments with Bluetooth and Arduino
- -steves-
- Administrator
- Posts: 2445
- Joined: Thu Jul 28, 2011 1:50 pm
- Location: Cambridge & Peterborough
Re: Initial experiments with Bluetooth and Arduino
Rik
I love this idea and think it looks very funky. It's certainly cheap and for that is quite appealing.
One of the down sides is only 10 steps for control. Do you know if this can be changed later on to a much greater number, like 100?
Secondly, will this only work with a 12v ish supply? What about loco's running 18v or indeed 3v?
Cheers
Steve
I love this idea and think it looks very funky. It's certainly cheap and for that is quite appealing.
One of the down sides is only 10 steps for control. Do you know if this can be changed later on to a much greater number, like 100?
Secondly, will this only work with a 12v ish supply? What about loco's running 18v or indeed 3v?
Cheers
Steve
The buck stops here .......
Ditton Meadow Light Railway (DMLR)
Member of Peterborough and District Association
http://peterborough.16mm.org.uk/
Ditton Meadow Light Railway (DMLR)
Member of Peterborough and District Association
http://peterborough.16mm.org.uk/
- idlemarvel
- Trainee Fireman
- Posts: 136
- Joined: Tue May 28, 2019 1:59 pm
Re: Initial experiments with Bluetooth and Arduino
You don't need a SIM card at all to use the bluetooth feature of a phone, same applied to wifi. I use an old SIM-less iPhone 4 as my wireless train controller.philipy wrote: ↑Tue Jul 02, 2019 6:07 am ...However, a couple of quick questions first -
1) is it necessary to have a fully working smart phone for the Bluetooth side of things to function, i.e with a valid SIM card installed? The reason I ask is that I don't possess such a beastie, but cheap 2nd hand units are available and might be worth the investment as long as I don't also have to fork out for a SIM account ( what did you say about being a cheapskate??).
...
Dave Miller
currently building the 5" gauge Circle Line
currently building the 5" gauge Circle Line
- BorisSpencer
- Fireman
- Posts: 251
- Joined: Thu Apr 05, 2018 2:36 pm
- Location: East Northants
Re: Initial experiments with Bluetooth and Arduino
You're stuck with the codes the android app is transmitting.
But looking at the example code, it wouldn't take much of a change to use one of the on-off switches as a 'gear selector' to add more granularity to the speed control. Effectively giving a high and low range.
Re: Initial experiments with Bluetooth and Arduino
Thanks Dave.idlemarvel wrote: ↑Tue Jul 02, 2019 4:11 pmYou don't need a SIM card at all to use the bluetooth feature of a phone, same applied to wifi. I use an old SIM-less iPhone 4 as my wireless train controller.philipy wrote: ↑Tue Jul 02, 2019 6:07 am ...However, a couple of quick questions first -
1) is it necessary to have a fully working smart phone for the Bluetooth side of things to function, i.e with a valid SIM card installed? The reason I ask is that I don't possess such a beastie, but cheap 2nd hand units are available and might be worth the investment as long as I don't also have to fork out for a SIM account ( what did you say about being a cheapskate??).
...
Philip
- BorisSpencer
- Fireman
- Posts: 251
- Joined: Thu Apr 05, 2018 2:36 pm
- Location: East Northants
Re: Initial experiments with Bluetooth and Arduino
Apologies for quoting my own post, it also wouldn't take much to smooth the transition between the 10 increments at the Arduino end, i.e. multiple steps between speeds. The 10 increments are probably because we are looking at software orininaly scoped to control basic track-powered 00 locos.BorisSpencer wrote: ↑Tue Jul 02, 2019 4:18 pmYou're stuck with the codes the android app is transmitting.
But looking at the example code, it wouldn't take much of a change to use one of the on-off switches as a 'gear selector' to add more granularity to the speed control. Effectively giving a high and low range.
- tom_tom_go
- Driver
- Posts: 4824
- Joined: Wed Feb 23, 2011 3:08 am
- Location: Kent, UK
- Contact:
Re: Initial experiments with Bluetooth and Arduino
I believe Apple phones need a Sim card initially to boot up when new but after that you can take the Sim out and use it on Wi-Fi.
Re: Initial experiments with Bluetooth and Arduino
Steve has already produced an app with 18 speed steps. What appeals to me is you can have two different speed profiles for each loco. The motor driver has two outputs so it's possible to switch from one to the other. Hence I could have 18 steps with a low top speed for shunting and then another profile with a higher top speed. See -
Rik
Rik
Re: Initial experiments with Bluetooth and Arduino
Theoretically it should be possible to get up to 255 speed steps. As mentioned above, Steve has already produced an app with 18 steps. It's surprising how the steps aren't noticeable except at lower speed settings. I'm going to experiment with more profiles as the default top speed is too high for my railway.-steves- wrote: ↑Tue Jul 02, 2019 3:47 pm Rik
I love this idea and think it looks very funky. It's certainly cheap and for that is quite appealing.
One of the down sides is only 10 steps for control. Do you know if this can be changed later on to a much greater number, like 100?
Secondly, will this only work with a 12v ish supply? What about loco's running 18v or indeed 3v?
Cheers
Steve
The motor shield can handle 5v - 46v and 2A per channel (there are two) so, apart from the lower end, it should be ok for most of our needs. There are other motor shields with different characteristics, so there will probably be one suited to controlling lower voltages.
Rik
Edit: Just realised that the Arduino needs 5v for its logic circuits and so that's the minimum voltage you could have in your loco. Regarding the control of a loco with a 3v motor - you could just tailor the speed profile to keep the maximum speed realistic.
Last edited by ge_rik on Tue Jul 02, 2019 7:22 pm, edited 1 time in total.
-
- Cleaner
- Posts: 95
- Joined: Sat Oct 20, 2012 4:15 pm
Re: Initial experiments with Bluetooth and Arduino
With regards to the lack of tactility, it looks like it should be pretty straightforward (for anyone with the prerequisite knowledge) to make a transmitter like the common knob-and-reverse-switch type that works over the bluetooth link.
I have been playing with alternatives to the usual Deltang type setup for a while, in an attempt to keep the costs down. My latest messing about has brought me to cheapo chinese clone NRF24L01+ modules, with these you get a 2 way radio link for £2. I built a transmitter that is basically an Arduino with built in radio module, USB LiPo battery charger, OLED screen and buttons for menus, reverse switch and speed knob, photo attached. Would be relatively easy to use a bluetooth module instead of an NRF24.
On the other end, I wanted an integrated solution to radio control, motor driving and sound effects. I managed to get an AVR playing multiple sound files off an SD card at the same time, and another one sorting the radio and motor control, but when it came to integrating both functions into one little 8-bit chip... I was asking too much of either it, or my programming skills. Now looking into more powerful alternatives that also don't break the bank...
I have been playing with alternatives to the usual Deltang type setup for a while, in an attempt to keep the costs down. My latest messing about has brought me to cheapo chinese clone NRF24L01+ modules, with these you get a 2 way radio link for £2. I built a transmitter that is basically an Arduino with built in radio module, USB LiPo battery charger, OLED screen and buttons for menus, reverse switch and speed knob, photo attached. Would be relatively easy to use a bluetooth module instead of an NRF24.
On the other end, I wanted an integrated solution to radio control, motor driving and sound effects. I managed to get an AVR playing multiple sound files off an SD card at the same time, and another one sorting the radio and motor control, but when it came to integrating both functions into one little 8-bit chip... I was asking too much of either it, or my programming skills. Now looking into more powerful alternatives that also don't break the bank...
- Attachments
-
- IMG_20190702_181222.jpg (80.52 KiB) Viewed 5086 times
Re: Initial experiments with Bluetooth and Arduino
Really interesting stuff - you read my mind - I've got some NRF24L01+ modules on order and am just researching a Bluetooth equivalent. Gregh has been playing with 8-pin Picaxe chips for quite a few years and is experimenting with controlling sound files from an SD card as well as controlling the speed. You probably have a lot in common.metalmuncher wrote: ↑Tue Jul 02, 2019 6:41 pm With regards to the lack of tactility, it looks like it should be pretty straightforward (for anyone with the prerequisite knowledge) to make a transmitter like the common knob-and-reverse-switch type that works over the bluetooth link.
I have been playing with alternatives to the usual Deltang type setup for a while, in an attempt to keep the costs down. My latest messing about has brought me to cheapo chinese clone NRF24L01+ modules, with these you get a 2 way radio link for £2. I built a transmitter that is basically an Arduino with built in radio module, USB LiPo battery charger, OLED screen and buttons for menus, reverse switch and speed knob, photo attached. Would be relatively easy to use a bluetooth module instead of an NRF24.
On the other end, I wanted an integrated solution to radio control, motor driving and sound effects. I managed to get an AVR playing multiple sound files off an SD card at the same time, and another one sorting the radio and motor control, but when it came to integrating both functions into one little 8-bit chip... I was asking too much of either it, or my programming skills. Now looking into more powerful alternatives that also don't break the bank...
My programming skills are acquired purely on a need to know basis - trouble is I sometimes don't know what I don't know .....
Rik
Edit: Just discovered that the HC-05 Bluetooth module is in 'slave' mode by default but can be reprogrammed into 'master' mode. Time for a play....
Last edited by ge_rik on Tue Jul 02, 2019 8:49 pm, edited 1 time in total.
Re: Initial experiments with Bluetooth and Arduino
My trouble is that I know I just don't know enough!
Funnily enough, I was mentally playing around with this whole concept earlier this afternoon. I had seen that Steve had an 18 step version and my gut instinct said that there ought to be a way to build "a bluetooth transmitter with knobs", but my trouble is that I wouldn't actually know where to start. What Rich has just described sounds like a practical version of my gut instinct, even if he still wants to do more development.
Philip
Re: Initial experiments with Bluetooth and Arduino
BTW - Just went strolling off down the street with my phone and put the loco on a length of track on the front lawn. I got a range of 46m (well 46 large strides). So should be adequate for most modest gardens.
Rik
Rik
Who is online
Users browsing this forum: No registered users and 3 guests