Recommended Posts

Hi codefox,

you started this topic to seek some advice and it ended up more the other way around. :)

I frankly do not know anything about Lego (I only played with the Mindstorms NXT thing for a while), but my friend asked me if I would be able to come up with a Bluetooth replacement for the IR Lego remote and since I was already looking forward to play with something that uses wireless transfers, I started to think about it in my free time and came up with essentially the same thing you did -- and few days later, my friend found out about this topic.. :))

I'm going to use the HC-06 as well, but a different driver chip (DRV8833, the one in V2 PF receiver, since it basically seems to be the only one with reasonable parameters and availability in my country..) and a PIC16F1508 for the MCU, since I'm aiming for something more like an universal Bluetooth remote control "platform" (so I can simply use a scaled-up version with the same FW/HW to control lights or other stuff at home, make a 4-motor version, provide feedback from various sensors or whatever.. ) and even though I like AVR's more, Atmel just did not not have the right chip for the job this time (or maybe they do, but not available in Europe again, oh well..). Oh, and I'll probably use your lovely Android remote if you don't mind, no reason to develop that twice, right..? ^^

I'm still several steps behind you, but I've received my Bluetooth modules just today, so I'll build something up in the following days / weeks (not much time for "hobbies" unfortunately..) to test my circuit and then proceed to the PCB design (I don't think I'll manage to make it so small, it is only my third non-trivial design (+first SMD-based) and my primary manufacture method is still toner transfer so I'm running into the same vias issues as BrianZ ^^). I definitely want the polished-up later boards to be complete with solder mask and silkscreen, but the local manufacturers look quite expensive for small batches / samples (so I never even tried to get something manufactured) -- the OSH Park seems really great for this, thanks for the link..

I really wonder what comes out of this, (in both cases ^^) I just hope my DRV8833 does not burn-up on the first try as I don't have anything to use for soldering the thermal pad.. :D (guess some thermal conductive paste will have to do..)

Anyway, thanks for sharing all your experiences, I may find them useful as I continue. :)

Share this post


Link to post
Share on other sites

H-S,

The DRV8833 comes in two forms, the square one with pads on all 4 sides, and the one with pads on two sides. I used the one with pads on two sides, and I used solder paste and an electric skillet to solder it. I put a blob of solder on the thermal copper surface I made just below it, and it seemed to solder and dissipate heat just fine. I have had to re-work every single one of the ones I have made; apparently I am using too much solder paste. They all turned out fine with solder wick and an xacto knife in the end though. My point is that I have had to reheat every one of the DRV8833 chips, sometimes with the skillet and sometimes with my soldering iron, and they all survived. This is the first thing I ever soldered that was surface mount, so experience isn't critical, apparently. Pololu offers a DRV8833 board already soldered that I would like to try. It's small.

I'm going to do a writeup on my updated system any day now. I'll post here when I have more information.

Brian Z

Edited by BrianZ

Share this post


Link to post
Share on other sites

Hi Brian,

thanks for the idea. I was thinking about solder paste before, but it seems quite expensive (and has limited shelf life or so I heard). For the price of two or three tubes I can have a basic hot-air soldering station instead so I may get one in the near future (I'm moving to SMD stuff anyway so it comes handy) and then simply solder the chip by applying a thin layer of ordinary solder + flux first and re-heating it. Should work like with the solder paste, I guess? Before that I'll just avoid high-current loads when testing.. (although, reconsidering my first post, the thermal protection shouldn't let me blow it up anyway.. :) ).

I was worried the excessive heat during "soldering experiments" could kill the device, but the datasheet mentions something about peak temperature 260 °C ("Level-3-260C-168 HR") -- I searched a bit and it seems to be pretty standardized; for example most Maxim devices should be able to withstand 260 °C for about 30 seconds (see http://www.maximinte...cfm#PEAK_REFLOW for details). The DRV8833 has the same peak temperature so the time could be similar.. And 30 seconds seems to be pretty generous, so no worries after all...

Share this post


Link to post
Share on other sites

I get my solder paste from Sparkfun, at $9 for more than I would ever use. A rework station might be nice though. My version 2 of my 2.4GHz Lego remote control receiver is giving me fits, as my first surface mount project. Too much paste, not enough, solder bridges, and whatnot. It's harder than I thought, but I think that I'll get better quickly.

Brian Z

Share this post


Link to post
Share on other sites

Oh, and I'll probably use your lovely Android remote if you don't mind, no reason to develop that twice, right..? ^^

By all means, please do! You can find the latest code here: https://github.com/BTbricks/brickster-android

Pololu offers a DRV8833 board already soldered that I would like to try. It's small.

I have some of these lying around. I meant to do a breadboard prototype with them before creating a second revision of the PCB, but the first revision was a bit of a failure learning experience, so I stuck with my previous driver for now. I was considering using Pololu's DRV8833 board as a sort of plug'n'play solution, attached to the PCB via headers.

Coincidentally, it was these boards that inspired my ~0V drop rectification subsystem.

My version 2 of my 2.4GHz Lego remote control receiver is giving me fits, as my first surface mount project. Too much paste, not enough, solder bridges, and whatnot. It's harder than I thought, but I think that I'll get better quickly.

Good luck with the paste! I haven't tried it myself, but it would definitely help for making things en masse. I learned SMD using a soldering iron with a fine point tip and have stuck with it.

Edited by codefox421

Share this post


Link to post
Share on other sites

Remains to try to control it using NXT/EV3 BT...

I proudly present my 8884bt being controlled from an NXT programmable brick! :grin:

http://www.brickshel...8884bt_demo.rbt

Please excuse the 3rd party LiPo. There are solder points for standard PF connections, but I lack a PF battery box.

I also lack an EV3 to test, but I assume it would work. As far as I can tell, the EV3 supports the Bluetooth Serial Port Profile, which is used by the RN-42, HC-06, etc.

There remains an issue with the voltage rectification. It works, but has some properties I didn't know to account for in my design. I'll be sorting this out as well as replacing the RN-42 for the much cheaper HC-06 in an upcoming iteration.

I'm also debating whether or not I should replace the TB6612FNG with the DRV8833. Is the extra 500mA per channel worth the effort? I suppose it may be. I'll have to do some prototyping to investigate.

Also on the to-do list are some improvements to the Android app, namely connecting to multiple receivers simultaneously, assigning nicknames to receivers, and some small UI tweaks.

Thoughts?

Share this post


Link to post
Share on other sites

The more mA the better! It'd be like the V2 receiver over the V1. You may need to add thermal protection if you go for the extra power though...

Share this post


Link to post
Share on other sites

I've been giving consideration to the command set the receiver will recognize. Here are my current thoughts: http://codepen.io/anon/pen/Kirqj What commands would you add? Are there commands listed that seem unnecessary?

To summarize some of the things being discussed elsewhere, here is a revised command architecture: http://codepen.io/anon/pen/nxhzt/

It has also been mentioned that there are 3 microcontroller I/O pins plus 3.3V board power on the programming header, which could be used for auxiliary functions (e.g. LEDs).

Edited by codefox421

Share this post


Link to post
Share on other sites

Do you knw how many connections the android can have open at once? will you be able to have the device control more than one train at a time?

Share this post


Link to post
Share on other sites

Do you knw how many connections the android can have open at once? will you be able to have the device control more than one train at a time?

I've been meaning to investigate this for quite some time now, but your post reminded me of the need to spring into action. Thanks for that! :grin:

The bluetooth spec defines two limits: maximum active connections is 7, maximum inactive connections is 248. However, it's also hardware dependent. My phone may only be able to achieve 3 of those theoretical 7 active connections, while someone else's may be able to achieve all 7.

As a proof of concept, I threw together a modification of the android app tonight which allows for multiple simultaneous connections (something I had already achieved with NXT quite easily). The multi-connect feature will definitely need some love before it's ready for the wild, but perhaps I can take a quick video in the morning. It's been a long day and sleep is calling. :sadnew: <( z z Z Z )

Share this post


Link to post
Share on other sites

I think the 7 is a blue tooth limit, I was looking as a very smiler project a while ago, and realised that this is the main issue with bluetooth and it really gets in the way once you want to add track side accessories. However for trains I think 7 will be more than enough for most home layout controls and will be really nice on a tablet. keep up the good work, cant wait to see it all up and running with a few trains wizing around.

Share this post


Link to post
Share on other sites

It feels better to post this here instead of going off-topic elsewhere.

I would happily buy a few of the blank boards from you. I have a solder rework station at work I can use and I can order the chips myself. PM me if you're willing.

You can order them straight from OSHPark here: https://oshpark.com/...ojects/jNrizzs2 or download the BRD file for editing with EagleCAD (6.5 is what OSHPark uses).

Here's the BOM for ordering parts. A programmer is also needed if you don't have one (I suggest AVRISPmkII), and pogo-pins are helpful.

Firmware tweaks for the new board revision may take some time as the PCBs I ordered are still being fabbed.

I make no money from the above links; I'm just excited to maybe get my device into someone else's hands! :laugh:

Please let me know how it goes.

Edited by codefox421

Share this post


Link to post
Share on other sites

It feels better to post this here instead of going off-topic elsewhere.

You can order them straight from OSHPark here: https://oshpark.com/...ojects/jNrizzs2 or download the BRD file for editing with EagleCAD (6.5 is what OSHPark uses).

Here's the BOM for ordering parts. A programmer is also needed if you don't have one (I suggest AVRISPmkII), and pogo-pins are helpful.

Firmware tweaks for the new board revision may take some time as the PCBs I ordered are still being fabbed.

I make no money from the above links; I'm just excited to maybe get my device into someone else's hands! :laugh:

Please let me know how it goes.

Awesome, I'll give it a shot soon.

Share this post


Link to post
Share on other sites

Where are you sourcing the BT chip from? Everything else is on Digikey. The only one I see is this: http://www.digikey.c...99-1-ND/2813585 and it's $15, which seems pricy.

Edit: Will this work? http://www.ebay.com/...=item338382f705

It's slaved. Same seller has a listing for master too.

Also, do you have a programmer you recommend? There seem to be a ton of choices...

Edited by legoman666

Share this post


Link to post
Share on other sites

wow awesome work! are you going to sell these as complete units? I would definitely buy some.

I've been considering it. It will take a little while before I'm comfortable selling any; I haven't even assembled a rev. 2 board yet! (waiting on some orders)

Where are you sourcing the BT chip from? Everything else is on Digikey. The only one I see is this: http://www.digikey.c...99-1-ND/2813585 and it's $15, which seems pricy.

Hm... I need to find a better way of documenting that. Anyway, I've had success sourcing mine from iTead. Expect long lead times though. I've heard of other people buying them from DX, but I haven't tried. DX is a little cheaper if you're buying three or more (wish I had known a couple days ago). They probably have long lead times too, but I don't know. If you choose DX, please let me know how it goes.

Share this post


Link to post
Share on other sites

I ordered everything listed x 4, except for the board itself, I ordered a set of 3. Minus the cost of the programmer, everything was pretty cheap. About $15 per board. The driver chip has thermal overload protection and current limited output, right?

Share this post


Link to post
Share on other sites

I ordered everything listed x 4, except for the board itself, I ordered a set of 3. Minus the cost of the programmer, everything was pretty cheap. About $15 per board. The driver chip has thermal overload protection and current limited output, right?

Checked the datasheet to be sure: it has over-current, thermal-overload, and under-voltage protection. :thumbup:

Share this post


Link to post
Share on other sites

Checked the datasheet to be sure: it has over-current, thermal-overload, and under-voltage protection. :thumbup:

Excellent. Looks like the same maximum voltage applies to this custom controller as the regular LEGO controller. The chip with the lowest maximum is the driver itself. I'll run it at the max: 10.8VDC ;)

Now if only I had a controller with 2 drivers in parallel.... I have a train with 4L's that could benefit from something like that. Right now I just use 2 IR receivers in parallel, but the PWM causes them to do funny things at any speed other than maximum.

Share this post


Link to post
Share on other sites

Now if only I had a controller with 2 drivers in parallel.... I have a train with 4L's that could benefit from something like that. Right now I just use 2 IR receivers in parallel, but the PWM causes them to do funny things at any speed other than maximum.

nwpumQ0h.jpg

I see. You're using two receivers in parallel to overcome the separated red/blue output channels (and potentially current protection on the battery boxes?) You could tweak the BT receiver's firmware to control both red and blue output channels with only one (ex. red) input channel. The driver chip should be able to support that load, your PWM waveforms will be synchronized, and you'll only need one BT receiver!

Excellent. Looks like the same maximum voltage applies to this custom controller as the regular LEGO controller. The chip with the lowest maximum is the driver itself. I'll run it at the max: 10.8VDC ;)

In fact, it uses the same driver chip as version 2 of LEGO's IR receiver. Thanks to Philo for figuring that out and posting it on his website: http://www.philohome...pfrec/pfrec.htm

It's a little unfortunate though. I liked the TB6612FNG's 15V maximum and the 11.1V 3S lipos I could use with it. Oh well! :laugh:

Share this post


Link to post
Share on other sites

I see. You're using two receivers in parallel to overcome the separated red/blue output channels (and potentially current protection on the battery boxes?) You could tweak the BT receiver's firmware to control both red and blue output channels with only one (ex. red) input channel. The driver chip should be able to support that load, your PWM waveforms will be synchronized, and you'll only need one BT receiver!

In fact, it uses the same driver chip as version 2 of LEGO's IR receiver. Thanks to Philo for figuring that out and posting it on his website: http://www.philohome...pfrec/pfrec.htm

It's a little unfortunate though. I liked the TB6612FNG's 15V maximum and the 11.1V 3S lipos I could use with it. Oh well! :laugh:

Correct. I tried tying both outputs of a single IR receiver together but ran in to problems. Even now, with 2 separate receivers tied together, the PWM waveforms interact weirdly at anything other than 100%. The train will run for about 5 seconds and then it'll start to stutter. I will probably tie both outputs of the DRV8833 chip together as you recommended. The datasheet even lists this as a supported configuration and gives yields a full 2x the current output of a single channel (3-4A total).

Also, you were correct in your suspicion of running in to the current limiting thermal fuse in the AA battery packs (there are 2 in my train). I opened up the packs soldered in a wire to bypass the fuse. The rechargeable batteries I use are good for more than the fuse allowed.

Is there a way to program the android app to tell the controller to slowly come to a stop when you press stop? Pressing stop makes my train derail; there's a lot of momentum behind the locomotive (16' long). Looks like the DRV8833 chips supports it, I guess I'll have to delve in to the code myself once I get everything working initially.

Edit: looks like I can just link the two inputs on the driver together to get my desired effect. No need to change the code.

Edited by legoman666

Share this post


Link to post
Share on other sites

Is there a way to program the android app to tell the controller to slowly come to a stop when you press stop? Pressing stop makes my train derail; there's a lot of momentum behind the locomotive (16' long). Looks like the DRV8833 chips supports it, I guess I'll have to delve in to the code myself once I get everything working initially.

I assume you mean the difference between brake and float. Yes there are a couple ways:

You can use either method, but I would suggest the firmware edit. It will cause the receiver to act the same way no matter what version of the app you are using to control it.

Edit: looks like I can just link the two inputs on the driver together to get my desired effect. No need to change the code.

Yes, you can definitely do this. I thought changing the firmware would be easier than changing the hardware, but either works. If you go this route, be sure to cut the two traces for the channel you won't be using between the ATtiny84 and the DRV8833.

Do you have a prebuilt version of the android app? I'd like to avoid installing the SDK.

Here you go: https://www.dropbox....ing-04-best.apk

Share this post


Link to post
Share on other sites

Thanks! My PCB's was sent off to the fab on the 20th, should have it back around the beginning of July. Can't wait! One of them is going to be in Horizon Express:

http://youtu.be/j4vRp05qUuQ

In the video, it's zipping around at 10V with a V1.1 IR receiver (temporarily using the electronics car from my freight train). I'll bump it up a little more to 10.8 when I get the BT controller up and running. The app is missing the background image on the controller screen:

jRVVoyFh.jpg

Edited by legoman666

Share this post


Link to post
Share on other sites

Thanks! My PCB's was sent off to the fab on the 20th, should have it back around the beginning of July. Can't wait! One of them is going to be in Horizon Express:

In the video, it's zipping around at 10V with a V1.1 IR receiver (temporarily using the electronics car from my freight train). I'll bump it up a little more to 10.8 when I get the BT controller up and running. The app is missing the background image on the controller screen:

Hm... that's not right! :wacko: On what model of phone are you running the app? Does it do the same thing for the momentary controller?

Your HE looks great, nice and zippy like a high speed train should be. :thumbup: Can't wait to see it on 10.8V!

My PCBs should get back from the fab tomorrow. I'm looking forward to getting them up and running, so I can make sure the firmware is in tip-top shape. I have some time to wait for the BT modules, but I have a single one that I can use for debugging in the meantime.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.