Motor Shield Rev3

Discuss suspected bugs with other users and Sim Innovations Staff

Moderators: russ, Ralph

Message
Author
Pkaser
Posts: 61
Joined: Mon Jul 15, 2019 7:15 pm

Re: Motor Shield Rev3

#11 Post by Pkaser »

Sling wrote: Tue May 04, 2021 10:10 am Turning things on/off with the led function was mentioned and that is not necessary. In fact it has caused some problems doing this in the past. If its a simple on/off then the digital out functionality is the one to use.

As Joe says if using a specific driver/shield then make sure you use it as prescribed.
@Sling I was using it to vary the intensity of the shaker mostly. I just copied the same code to the Hobbs and set it to 1 when the engine is running and to 0 if the sim was paused or engine was off. I didn't really think it was a huge deal to use hw_led_set instead of the hw_output_set...a high being a high and a low a low and all. But I have changed my code to conform with your documentation. I apologize for taking a short cut.

@jph Thanks for your patience and your suggestions. I searched the forums here for motor shield and didnt see much of anything. If there is documentation in the Wiki on it, I'm sure not seeing it 8-) .

If using the LED function to vary the intensity of the shaker is a bad idea and using PWM is the best way, I will do that. The reason I used the LED is because I ramp up the intensity based on the RPM of the rotor blades, and the duration it shakes. LED seemed like it was the best route to turn it off, on and change intensity. Also when there is a tail strike, it gets super-intense. I usually turn off the shaker for 20% - 60% of the blade revolution to create a pulse/vibration that matches the rotor rpm, not just a shake, like you feel in the real helicopter. It isnt just a set-and-forget intensity.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Motor Shield Rev3

#12 Post by jph »

Pkaser wrote: Wed May 05, 2021 12:53 am
Sling wrote: Tue May 04, 2021 10:10 am Turning things on/off with the led function was mentioned and that is not necessary. In fact it has caused some problems doing this in the past. If its a simple on/off then the digital out functionality is the one to use.

As Joe says if using a specific driver/shield then make sure you use it as prescribed.
@Sling I was using it to vary the intensity of the shaker mostly. I just copied the same code to the Hobbs and set it to 1 when the engine is running and to 0 if the sim was paused or engine was off. I didn't really think it was a huge deal to use hw_led_set instead of the hw_output_set...a high being a high and a low a low and all. But I have changed my code to conform with your documentation. I apologize for taking a short cut.

@jph Thanks for your patience and your suggestions. I searched the forums here for motor shield and didnt see much of anything. If there is documentation in the Wiki on it, I'm sure not seeing it 8-) .

If using the LED function to vary the intensity of the shaker is a bad idea and using PWM is the best way, I will do that. The reason I used the LED is because I ramp up the intensity based on the RPM of the rotor blades, and the duration it shakes. LED seemed like it was the best route to turn it off, on and change intensity. Also when there is a tail strike, it gets super-intense. I usually turn off the shaker for 20% - 60% of the blade revolution to create a pulse/vibration that matches the rotor rpm, not just a shake, like you feel in the real helicopter. It isnt just a set-and-forget intensity.
HI @Pkaser
No worries at all. Don't rely on the wiki here having documentation for additional add on boards, that is not really feasible or appropriate in most cases. A good google search is 99.9% reliable, however, I fully understand why you may try here first as it worked previously. There should not be any issue using the Led brightness. It is not a bad idea at all. If it worked for you before and did what you intended it is perfectly fine as it provides a simple PWM, which is all you need really unless you needed REALLY precise control then hardware PWM would be recommended.
For the hobs, I presume you just need it on or off ? - if so, then yes, simply use hw digital output.
You don't HAVE to use a specific feature or function for a specific use. You can be as creative as you want providing that you have a reasonable understanding of what it does, and of course, that the end result is what you wanted. :D ;)
Stick with the LED when the new image is ok, if you want to.
A mega may be better than a Leonardo if you go the HW PWM route. The leonardo is an amazing board, but is aimed more at HID/USB, although it certainly can be used !. it has tremendous features. I think the mega is cheaper though. A mega is around 9 euro including postage and a Leonardo about 10 euro. Far more pins and opportunities with the mega if not using HID.. If you don't know what HID is, then you don't it. :D .
So, whatever you need. The uno will work ok with the beta image (I presume) using the LED/LED Brightness in non critical low res PWM solutions.
Also, I must thank you for reminding me of this board. I had completely forgotten about it. I have plenty of H Bridge motor drivers but this board is really neat and only about 5 euro inc postage. !
What I hadn't noticed in the past is that there is current monitoring (load monitoring) output to ADC and also braking function. REALLY nice. Ordered a couple yesterday
So thanks for the reminder also ..
Joe
Joe. CISSP, MSc.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Motor Shield Rev3

#13 Post by Sling »

Ah ok you didn’t mention varying intensity before. You just said on/off. In this case it’s probably best to use the PWM output but as Joe says because the LED provides output provides a PWM function to vary brightness it’s probably ok to use this for your needs. Especially as you have proven it does the job.

I’m glad we got there in the end.

Pkaser
Posts: 61
Joined: Mon Jul 15, 2019 7:15 pm

Re: Motor Shield Rev3

#14 Post by Pkaser »

Thanks. Reflashing the Uno with the AM4 beta resolved the issue.

Post Reply