The Craftmans Shop > Radio Control Models
Bruder Manitou 2150 - RC conversion
ddmckee54:
I just about got the design for the cab/turret slew drive done last night. I thought I was done, until I realized that while my turret drive gear has 6 reinforcing ribs in it's design, the turret base actually had 8. Silly me, I had ASSUMED that they both had 6. Fixing the 3D model took a while, and it sort of hurts when you have to throw away a perfectly good design - just because it's WRONG.
On to bigger and better, or at least different, things. I'm going to use the 9 channel Turnigy transmitter and 6 channel Turnigy receiver that I've got, which are currently laying around doing nothing. They were both low cost units so I don't feel too bad about tearing into the transmitter to replace the current 5th and 6th channel inputs with my 5 position switches. I think that currently one is a 2 position switch for retracts, and the other is a variable pot. My digital servos and programmer also arrived last week, so once I get this easy stuff out of the way, I've still got those 5 position servo selectable switches to deal with.... Oh Frabjous day!
I keep getting the "Switch in wrong position" error on power up of the transmitter. I need to Google that error again, I know that there is a specific combination of switch settings this transmitter needs on power up - or it pukes out the error message. This time I'm gonna make a tag of the correct settings and stick it to the transmitter.
I'll get the transmitter talking to the receiver, and the receiver talking to the Nano, then I can use the Nano to decode the desired receiver channel pulse widths into the light controls - EAZEE-PEAZEE. Or so I've been told.
For my two 5 position servo selectable switches, I'm going to use the 5th and 6th channels to set the selector switch settings. I'm then going to use what would normally be the Rudder stick to control one of the ESC's, and the modified Throttle stick will control the other ESC. I'm also going to need to see what I need to do to make the throttle stick self-centering. My 5 position selector switches have 2 center poles, and with a separate ESC wired to each switch, this allows me variable-speed directional control up of to 5 different motors with each switch. This way I'm not trying to send servo signals through the slip-ring, just 6VDC motor power that's well within the power limits of the slip-ring and is not as susceptible to electrical noise. Even though the slip-rings were designed for instrumentation, CCTV and camera gimbal controls, I don't want to push my luck.
Don
AdeV:
You can only service two interrupts on the Nano, and you can only have one ISR active per interrupt - although you can swap it in code, which is pointless because it's pretty easy to use the CHANGE type, and use the ISR to reset the time if the pin has gone HIGH, and record the time if it's gone LOW. So long as your main loop can get around to reading them before the next pulse arrives, you're good to go. Remember that the value from MICROS() wraps fairly frequently (every ~72 minutes, according to a post I read on the Arduino.cc forums), so your best bet is to use a "start time" variable (on rising edge) and an "end time" variable (on falling edge); subtracting the former from the latter will ALWAYS give you the correct number of microseconds, thanks to the magic of binary logic - so no need to worry about the clock rolling over.
A third (boolean) variable could be used to indicate that a pulse is "in progress", so you don't accidentally subtract the old pulse end time from the new pulse start time during a pulse. I'd have to sit down with an Arduino in hand to figure the logic, but I'm sure you can do that anyway.
I had wondered if you could do some electronic trickery to multiplex the pulses for the interrupt handler; but I guess with 2 channels, it's entirely possible that 2 pulses will overlap, which would give erroneous readings.
If you ever wanted to monitor more than 2 channels, I'd be tempted to set up a timer interrupt at a suitable resolution for your need (100uS maybe, given your statement about setting a pulse width of 1000uS if it came out less than that) which would scan each channel & set/reset the clocks as applicable. Yes, you'd lose a little accuracy, but not so much that it mattered, I'd wager, and you could monitor 8 channels with ease. Of course.... whether your main loop actually got enough program time is another matter; and I don't know if you can trigger an interrupt on a timer with Arduino; you may need an external trigger for that.
AdeV:
Hah! A few moments of googling show that timer interrupts are entirely possible on Arduino, although you can/do lose the use of some functions....
Good intro here: https://www.instructables.com/id/Arduino-Timer-Interrupts/
But since you're only doing 2 channels, it's more for academic interest than actual use :)
ddmckee54:
Ade:
Thanks for the info, when I started this I didn't know enough about Arduino interrupts to be dangerous, Now I know WAYYYYY more than enough to be dangerous. Starting from your link I stumbled upon a discussion of the fast servo library. There's some good stuff there, it's way more sophisticated than I need for this project, but definitely food for thought. It gives me a good idea of what I need to do in order to make this work, And how I need to set up my ISR's. You've probably saved me a bunch of time and much tearing of hair, something I can ill afford to do anymore.
All I really need to know, is if the steering channel and for/rev channel pulses are centered or not. They are centered if the pulse is approximately 1500uS long. Assuming a deadband of ±50µS then then if the value is below 1450µS, or above 1550µS then I know the stick is not centered. I'm not actually trying to control a servo from the Nano, just turn on a bunch of LED's. But it's still nice to know that the fast servo library is out there, for use in future projects.
Don
ddmckee54:
Not too much progress since last time. In my day job the two busiest times of my year are the Christmas shutdown and the July 4th shutdown. When the plant's not running, you've got to cram in as much process improvement work as you absolutely can. The plant's up and running again now so we can all take a couple of deep breaths - and then start getting ready to do it all over again in July.
I did get a little time to do some more work on the turret slewing gearbox. For a little while I thought that I had it completed, then I turned on the steering servos in my CAD drawing. The slewing gearbox and one of the steering servos were trying to occupy the same volume of space - not a particularly good idea. I wound up rotating the gearbox CCW 90° around the turret pivot axis, and letting the gearbox stick out the side of the frame - into the unused space inside the model fuel tank. That was mighty considerate of them, putting that big, well - relatively big, empty space right where I needed it.
I started printing out the parts for the turret slewing gearbox, when I've got it complete I'll take a family photo and I'll update the 3D PDF.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version