Search the Community
Showing results for tags 'arduino'.
Found 2 results
Following on from this thread, I think I'm now ready to start on the long and crazy path down building my own custom MFU using an Arduino Mega and some additional bits and bobs. Big shouts must go to @Ray_ve and @Nobbi1977 for their quick advice and useful info, without which I might have lost faith in the project and let it stall. So, what have I got planned, and will it all get done? Well, who knows for sure? This will be a fairly open-ended project and could keep me busy for a few weeks, a few months, or even a few years. I'm not 100% sure if and when I'll hit the limits of the Arduino Mega. I'm hoping I won't overflow the number of available inputs and outputs (the Mega has more than the Uno but I haven't done a complete count of my function list against the available ports yet), and I'm hoping I'll be able to buy a budget multi-channel handset that has the right number of the right type of switches (I have planned on using a lot of 3-way switches but my 6-channel Turnigy handset only has one 3-way switch, the rest are 2-way or dials). I don't know how easy it might be to swap out 2-way switches for 3-way switches on a budget radio - I'm guessing 'not easy'. So there may be quite a lot of re-thinking my inputs to get the functionality I want. Anyhoo, what does the project involve, and what am I hoping to achieve? Phase 1: Full lights - headlights, tail lights, brake lights, turn signals, fog lights, reversing lights. Driving modes - Off, Drive, Park. In Off mode, lighting will continue to work but no motor or steering input or other functionality will work. The throttle will be at the neutral position and ESC will have a drag brake, so the truck will not move. In Drive mode, the motor will drive the wheels and steering input will operate the steering servo. Park Mode will be much like Off mode and will not be used until a later phase. Gear select: I don't intend to use the Tamiya 3-speed gearbox. Instead I'll have a fixed ratio. Hopefully I can find a transmission that will do this so I can save some space under the cab, otherwise I'll fix the Tamiya transmission into 1st gear. Gear select will be a toggle switch so select Fwd/Rev (or Fwd/Neutral/Rev depending on handset functionality). In Neutral mode, the truck will not move when the throttle is applied. In Fwd, the motor will turn in a forward direction when up stick is applied. In Rev, the motor will turn in a backwards direction when up stick is applied. In both modes, the ESC will go into drag brake mode when the stick is pulled back. I may use a 'cruise control' throttle system here depending on how it feels on the layout. Phase 2: Engine sounds will be added. Other incidental sounds (such as brakes, compressor, etc) may also be added at this stage depending on how difficult it is to perform multi-channel audio operations. In Neutral mode, the throttle lever will cause the engine sound to rev but the motor will not turn and the drag brake will remain on. Phase 3: Additional functionality such as operating another servo for trailer legs, tipper, ramp, etc. will be added to the steering channel. This can be accessed by putting the truck into Park mode. Full additional sounds. There's lots of scope for additional stuff here too but I'll get to that later. I'll probably use a Hobbywing 1080 Crawler ESC. It's not the cheapest option but it can be configured with a strong drag brake and simple Fwd/Rev functionality. I didn't want to have to program around the awkward sometimes brake/sometimes reverse functionality on most ESCs and I hate that when in reverse, most ESCs don't have a brake, they just shoot forward. Using code I can make sure that pulling back will always stop the truck. I can also add some throttle profiling so it's not possible to go into full-speed fwd or rev to avoid any panic-inputs causing lots of damage on the layout. I may even alter the Park mode above so that the motor will continue to operate but at very reduced throttle and with the drag brake always on neutral. Obviously an ESC with an always-on drag brake isn't going to be easy to drive on the layout, so I'll add some throttle-off profiling to ramp the speed down gradually, or use a cruise control feature to keep the throttle in the last position until the stick is pulled back. Of course all this functionality needs a rig to power it, so I'll be building a King Hauler day cab from an NIB kit using Globe Liner chassis rails and a cut down cab. Truck build thread to follow once I've acquired some more parts and cleared up the workshop a bit Stay tuned - I'll be ordering some parts in the next few days and will start cutting code soon after that.
Anyone using Arduino devices in an RC setting? What have you achieved, what pitfalls have you uncovered? Is it as easy as the tutorials etc. say and do you ever have random "why doesn't this build" / "why has it crashed again" issues or are they genuinely quite trouble-free and stable? I royally avoided the Raspberry Pi hype when they appeared on the market a while back - some friends of mine bought them with the intention of doing something edgy and cool and AFAIK never got them to do anything at all. IIRC they were quite expensive back then so it seemed like a lot of money and time spent for no result. I'd heard of Arduino but I thought it would be pricey so I've never looked into it. That is until I was thinking about some lighting / sound / functionality requirements for my next big rig build, and I decided to see if anyone else had done something similar and what was involved. Long story short, last night I ordered an Elegoo Mega 2560 R3 and an L298n motor driver, all for less than £20. Delivery is due tomorrow. For all the things I've thought I'd do (such as taking inputs from RC receivers, producing sounds, controlling motors) there's already someone doing it. There's loads of source code online that does a bit of what I want to achieve. It's all pretending to be suspiciously easy and I'm not sure if I've missed something somewhere. I did a bit of electronics at college but it was mostly theory work. I remember doing projects on the 741 op amp and the 555 timer chips, I'm pretty sure I had them in a breadboard at one point, but it was all so long ago, I can't remember if we ever saw any live results. We used some breakout boards at college that used Z80 processors, but they were the size of an ipad and wouldn't fit under an RC shell. Besides, they were programmed in machine code, and making them do anything beyond adding two numbers and saying "I've added two numbers" by means of an LED (which didn't actually list the value of the added numbers) took hundreds of lines of unreadable code. Anyhoo, here I am already thinking out loud about what seems possible, and it makes me wonder if the likes of Beier and Servonaut got onto this a while back and that's why they can offer so much programmability in such small packages. In fact I've wondered if a lot of the electronic stuff on the market now, which used to be very expensive and is now cheap as anything (e.g. light/sound modules), uses Arduino boards or custom boards based on the Arduino design. There's no complex circuits to design from scratch and no low-level code to write. Just a bunch of boards made up by the thousand and anyone who knows C++... I'm digressing. It occurred to me that I hate how the Tamiya MFU has such a terrible throttle profile, especially for reversing. In fact I hate how the Tamiya MFU still uses that awful "pull once for brake, twice for reverse with no throttle profiling at all" thing. Try letting a fully-loaded rig roll down a ramp, you can either use the brake just once and hold it on, or you can use it twice and watch as your rear wheels go into reverse and either jack-knife the rig or reverse it into whoever is coming down the ramp behind you. But that's OK, I can make my own throttle profile. In fact I can move to a Beier-style throttle system with FWD/BRK or REV/BRK toggled by a switch or other input. (OK, I'm not sure yet how to make a motor brake instead of reverse over PWM, that's something to investigate). I can program my own sound system to use the sounds I want the way I want them. Alright, I might have issues with available RAM for samples and I'm not sure how many output channels I can use for other effects, but hey... I'm not sure I want to replicate Tamiya's entire lighting functionality. That seems like a step too far. But for my next rig I probably don't even need that - just a simple toggle setup for headlights, maybe a toggle switch for indicators (I hate that MFU-01 indicators only work on full lock and MFU-03 indicators need that little wiggle input to turn them on), and brake lights off the brake input. I'm guessing the two most daunting parts to any beginner are wiring up the peripherals and writing the code. Well, I did a bit of electronics in my younger years - I've got a lot to refresh myself on and no doubt I'll blow a few LEDs along the way and maybe even let the magic smoke out of an Arduino chip, but at current prices that's not the end of the world. And I'm a C# coder by day - nothing I've seen so far in the code samples I've read phases me at all. I'd love to see what anyone on here has done Arduino-wise. I'll be sure to update this with my results once I've got my first board plugged in and doing stuff, and I'll add a proper project thread once I've decided what my first major goals will be