Hi Martin,
I usually program the ATtiny85 modules via their usb (image as shown in post above).
For tools I use the board...... Digispark (Default -16.5mhz).
Just load up the program and when IDE says "plug in the ATTiny" one has 60 seconds to do so and it loads up no problem.
Just a query if I do it this way, what is the effect(if any) of the difference in the frequency setting of 16.5mhz to that which you specify in your video @16mhz.
No problem if it is required that your method with damellis has to be followed.
Cheers Jorgo
Any Arduino Gyro Projects
-
- Posts: 317
- Joined: 19 Jun 2019, 04:09
Re: Any Arduino Gyro Projects
Thanks for the info Phil.Phil_G wrote: ↑12 Jul 2020, 09:41 USBASP programming is so easy and has so many advantages that I dont follow why you would even bother with the USB Jeff:
no power-on delay (5 seconds on the original DigiSpark bootloader), half-size board, conventional 16mhz clock, more memory for programs, getting rid of the schottkys that spoil the ADC inputs A2 & A3...
JMHO...
So many times one sees differing methods and one never gets to know why.
-
- Posts: 745
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: Any Arduino Gyro Projects
You can use the Digispark USB for the project if you wish. The normal non-debug sketch only occupies a third of the program storage space, so there's plenty of room left for the Digispark bootloader. The extra five seconds of start-up time may not matter that much in this application. The gyro has to calibrate anyway before the servo output starts to work, so the user will get used to leaving the helicopter stationary for a few seconds after switching on, and shouldn't attempt take off until they can see that the tail rotor is responding.
When using the Digispark upload, you won't be able to use debug mode because the Digispark board setting doesn't include SoftwareSerial (I'm not sure why - perhaps because the 16.5MHz clock doesn't divide down to standard baud rates?). Even if you could get SoftwareSerial working, the debug version might not fit in memory because of the extra space taken up by the Digispark bootloader - the debug version takes about 85% of the space when not using the Digispark bootloader.
Like Phil, I prefer to ignore the Digispark upload method, despite its cleverness. Being able to saw off a good proportion of the board and getting more program space, a faster start-up, and Software Serial are much more useful, in my opinion.
When using the Digispark upload, you won't be able to use debug mode because the Digispark board setting doesn't include SoftwareSerial (I'm not sure why - perhaps because the 16.5MHz clock doesn't divide down to standard baud rates?). Even if you could get SoftwareSerial working, the debug version might not fit in memory because of the extra space taken up by the Digispark bootloader - the debug version takes about 85% of the space when not using the Digispark bootloader.
Like Phil, I prefer to ignore the Digispark upload method, despite its cleverness. Being able to saw off a good proportion of the board and getting more program space, a faster start-up, and Software Serial are much more useful, in my opinion.
-
- Posts: 317
- Joined: 19 Jun 2019, 04:09
Re: Any Arduino Gyro Projects
Thanks Martin.
Will follow through your instructions in the video and go the originally intended route.
Thanks for additional info as well.
One can search Google for ages sometimes and never find answers to specific queries.
Reminds me of a search I once did for my Yamaha Midnight Special.......wouldn't believe the responses that came back.
Cheers Jorgo
Possible to get someone to check the enclosed drawing for the correct connections..??
Thanks...
Will follow through your instructions in the video and go the originally intended route.
Thanks for additional info as well.
One can search Google for ages sometimes and never find answers to specific queries.
Reminds me of a search I once did for my Yamaha Midnight Special.......wouldn't believe the responses that came back.
Cheers Jorgo
Possible to get someone to check the enclosed drawing for the correct connections..??
Thanks...
-
- Posts: 745
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: Any Arduino Gyro Projects
Nice diagram, Jorgo! It looks right to me.
For the ones I built, I connected the +ve common from the battery / Esc / Servo to Vin rather than 5V. This means that it's safe to connect a battery (or Esc) that puts out more than 6V, but of course has the disadvantage that the volt drop across the Digispark's on-board voltage regulator means that the whole contraption stops working at a higher voltage than it otherwise would.
I tried mine with the MPU6050 connected to the same Vin point as the Digispark and everything worked down to 4.1V input, but stopped at 4.0V. I also tried connecting the VCC in to the 6050 to the "5V out" from the Digispark (which of course is a lot less than 5V with only 4.1V at Vin) and the whole thing still worked with a 4.1V supply.
My conclusion was that the ATtiny stops working first - probably at around 3.3V on the actual chip and that the MPU6050 (which has its own on-board 3.3V regulator) keeps working even when the supply to its regulator drops to around 3.3V.
I wound the supplied voltage up to 9V and nothing went pop: something would actually burn out at perhaps 13V or so, but I didn't want to risk testing that high!
If you have a supply from a battery or Esc that you are confident will never exceed 6V, then the connections you show in your diagram are a better way of doing it.
For the ones I built, I connected the +ve common from the battery / Esc / Servo to Vin rather than 5V. This means that it's safe to connect a battery (or Esc) that puts out more than 6V, but of course has the disadvantage that the volt drop across the Digispark's on-board voltage regulator means that the whole contraption stops working at a higher voltage than it otherwise would.
I tried mine with the MPU6050 connected to the same Vin point as the Digispark and everything worked down to 4.1V input, but stopped at 4.0V. I also tried connecting the VCC in to the 6050 to the "5V out" from the Digispark (which of course is a lot less than 5V with only 4.1V at Vin) and the whole thing still worked with a 4.1V supply.
My conclusion was that the ATtiny stops working first - probably at around 3.3V on the actual chip and that the MPU6050 (which has its own on-board 3.3V regulator) keeps working even when the supply to its regulator drops to around 3.3V.
I wound the supplied voltage up to 9V and nothing went pop: something would actually burn out at perhaps 13V or so, but I didn't want to risk testing that high!
If you have a supply from a battery or Esc that you are confident will never exceed 6V, then the connections you show in your diagram are a better way of doing it.
-
- Posts: 417
- Joined: 16 Feb 2018, 13:57
- Location: South Devon, UK
Re: Any Arduino Gyro Projects
Hi Martin,
Sample arrived safely in the lunch-time post today! Many thanks!
I'm currently mowing the lawns - only got back from Hastings late yesterday, and the garden looks like the Amazon Jungle! I'll have a play tomorrow, and get it in the heli. Hopefully test fly on Wednesday!
Cheers,
--
Pete
Sample arrived safely in the lunch-time post today! Many thanks!
I'm currently mowing the lawns - only got back from Hastings late yesterday, and the garden looks like the Amazon Jungle! I'll have a play tomorrow, and get it in the heli. Hopefully test fly on Wednesday!
Cheers,
--
Pete
-
- Posts: 745
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: Any Arduino Gyro Projects
Thanks Pete! If you find any problems in testing that I can fix with a program change, do you have a USBasp to upload the modified sketch? I can send you one if needed - I have a couple of spares.
-
- Posts: 417
- Joined: 16 Feb 2018, 13:57
- Location: South Devon, UK
Re: Any Arduino Gyro Projects
Hi Martin,
Had a fly today, in less than ideal conditions (small, light heli and very strong wind!). Partially successful!
Because of the wind, I was a bit stuck with what I could do - it was fight just to keep it in the air! Normal mode seemed OK, but heading hold did some very strange things!
I've got some video of it that I will edit up and put in dropbox. If you PM me your email address, I'll send a link to the video, along with what I *think* is happening (but I'm not sure!)
--
Pete
Had a fly today, in less than ideal conditions (small, light heli and very strong wind!). Partially successful!
Because of the wind, I was a bit stuck with what I could do - it was fight just to keep it in the air! Normal mode seemed OK, but heading hold did some very strange things!
I've got some video of it that I will edit up and put in dropbox. If you PM me your email address, I'll send a link to the video, along with what I *think* is happening (but I'm not sure!)
--
Pete
-
- Posts: 745
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: Any Arduino Gyro Projects
Here's Pete's video of his test flight. (Pete told me by email that it was okay to share the video on YouTube). Thank you Pete for testing it so quickly. I'm relieved that, thanks to Pete's cautious and expert flying, no harm came to his helicopter as a result of the bugs in my code.
Pete diagnosed that the gyro was losing track of its orientation when rotating fast. The initial fast rotation was caused by oscillation, which happened because of too much gyro gain (I'd made the settings too coarse, so even 35% gain was too much).
I'd made the mistake of only using the 250 degrees per second range of the gyro - the code was carried over from my earlier autopilot project, and 250 degrees per second was plenty for that. I'd forgotten that on a helicopter, 250 degrees per second is easily exceeded when deliberately performing fast pirouettes or when oscillations begin. There's no need for the low range anyway - even with the much higher 2000 degree per second range selected, the gyro still resolves 819.2 counts for each degree of rotation.
Stay tuned for a modified version of the firmware, with lower gain ranges, and using the 2000 degrees per second gyro range - that should be more than enough for even the most demanding 3D pilots!
Pete diagnosed that the gyro was losing track of its orientation when rotating fast. The initial fast rotation was caused by oscillation, which happened because of too much gyro gain (I'd made the settings too coarse, so even 35% gain was too much).
I'd made the mistake of only using the 250 degrees per second range of the gyro - the code was carried over from my earlier autopilot project, and 250 degrees per second was plenty for that. I'd forgotten that on a helicopter, 250 degrees per second is easily exceeded when deliberately performing fast pirouettes or when oscillations begin. There's no need for the low range anyway - even with the much higher 2000 degree per second range selected, the gyro still resolves 819.2 counts for each degree of rotation.
Stay tuned for a modified version of the firmware, with lower gain ranges, and using the 2000 degrees per second gyro range - that should be more than enough for even the most demanding 3D pilots!
-
- Posts: 417
- Joined: 16 Feb 2018, 13:57
- Location: South Devon, UK
Re: Any Arduino Gyro Projects
Cheers, Martin!
It was actually pretty good for a first attempt! The "normal" mode seemed OK, but because of the wind - close to the limit for that heli - I wasn't going to try anything spectacular!
The "Heading Hold" proved problematic, though! I nearly had to change my underwear after the first attempt! Luckily I was being very cautious and kept it close to the deck, so no harm done.
The video shows my final attempts after reducing the gain quite a lot in both modes. This particular machine has fairly slow servos (JR 591s), so you are never going to be able to run high gain anyway, without inducing oscillations.
I should really have tried it again in HH, but with even lower gain. The wind was getting stronger though, and I thought it best to quit while I was ahead!
Looking forward to the Mk2 firmware!
--
Pete
It was actually pretty good for a first attempt! The "normal" mode seemed OK, but because of the wind - close to the limit for that heli - I wasn't going to try anything spectacular!
The "Heading Hold" proved problematic, though! I nearly had to change my underwear after the first attempt! Luckily I was being very cautious and kept it close to the deck, so no harm done.
The video shows my final attempts after reducing the gain quite a lot in both modes. This particular machine has fairly slow servos (JR 591s), so you are never going to be able to run high gain anyway, without inducing oscillations.
I should really have tried it again in HH, but with even lower gain. The wind was getting stronger though, and I thought it best to quit while I was ahead!
Looking forward to the Mk2 firmware!
--
Pete