Any Arduino Gyro Projects

Any old or new electronic projects on the go
Post Reply
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

I've updated the firmware to "version 2" - now with reduced gain ranges, and using the gyro module's 2000 degree per second range. I updated the original post, so you can download it from the bottom of page 2.

Also there is the "manual", which is a work in progress, but does currently cover how to set up your Arduino IDE to support the ATtiny. I need to add in a section on how to connect up your USBasp to the gyro - I'm working on that right now, and will update again once it's done.
Pchristy
Posts: 413
Joined: 16 Feb 2018, 13:57
Location: South Devon, UK

Re: Any Arduino Gyro Projects

Post by Pchristy »

Looking forward to this!

:)

--
Pete
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

Thanks Pete! I've now updated the manual to also include how to wire up your USBasp. Let me know if you hit any snags or have any questions. :)

When you compile the sketch and press the 'upload' button some LEDs on your USBasp should light up for a while during the transfer process. Mine takes a surprisingly long time - maybe thirty seconds usually, and a minute or so if I edit the config.h file to put the gyro in debug mode (which makes the code larger).
Maybe there is something wrong with the USBasp I'm using, but you shouldn't worry if the upload takes longer than you expect.

I still need to cover how to use the Debug mode in the manual, and also some details on how to build the gyro in the first place - but Pete shouldn't need those parts to continue with his testing.
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: Any Arduino Gyro Projects

Post by bluejets »

Hi Martin,
Are you releasing the STL files for the box also..??
Pchristy
Posts: 413
Joined: 16 Feb 2018, 13:57
Location: South Devon, UK

Re: Any Arduino Gyro Projects

Post by Pchristy »

One quick question, Martin: 5v or 3.3v for the USBASP programmer?

The note you included with the gyro warns about voltages less than 4v.

I suspect that's because of on-board regulators, but can you confirm the correct programming voltage, please?

Cheers,

--
Pete
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: Any Arduino Gyro Projects

Post by bluejets »

Hi Pete,
5v shown in the video @ around 8:27 or there abouts.
Cheers Jorgo
Pchristy
Posts: 413
Joined: 16 Feb 2018, 13:57
Location: South Devon, UK

Re: Any Arduino Gyro Projects

Post by Pchristy »

Just to clarify, I'm talking about the USBASP setting. There's a little slide switch for 3.3 or 5v. This seems to be for programming rather than operating.

I know that something I've programmed had to use 3.3v, and I've always left it set to that. I thought it was Phil's encoder, but maybe mistaken.

Not had any problems at 3.3v, but just wanted to check as I'm relatively inexperienced with Arduino stuff! ;)

I was hoping to do the update today, but home life has interfered and it may be tomorrow now!

--
Pete
Pchristy
Posts: 413
Joined: 16 Feb 2018, 13:57
Location: South Devon, UK

Re: Any Arduino Gyro Projects

Post by Pchristy »

Update: I've hit a problem! Neither of my USBASP programmers has the link shown in the video for low speed mode!

I tried to upload the "bootloader" in the default mode, but just got a load of error messages!

Since it has already had the "bootloader" installed once, I thought I'd try just uploading the sketch. That seemed to work - at least it completed and verified - but the gyro now doesn't work. The servo responds to the transmitter only in one direction, and the gyro isn't functioning.

Hopefully, I haven't damaged the electronics, but unless I can find a USBASP with slow mode, I'm stuck!

--
Pete
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

5V is the correct setting for the ATtiny85.

The fast/slow link shouldn't be needed Pete - I found that some Digisparks need it when first 'burning bootloader' (which actually just sets the so-called 'fuses' of the ATtiny to make it work with the 16MHz clock). As you said, that's already been done for your gyro, and you shouldn't need to do it again.

Have you definitely plugged the two channels to your receiver back as before? The brown-red-orange lead is the 'rudder' channel, and the black-red-white one the mode and gain channel. The 'signal' pins are orange and white respectively.

If those are correct the next thing to try is uploading the sketch again. The blue-green 'status line' down near the bottom of the Arduino IDE should show "Uploading..." for a while (about 30 seconds on mine) and then "Done uploading." with no error messages below - the black and white part below the status line should show:

Code: Select all

Sketch uses 2882 bytes (35%) of program storage space. Maximum is 8192 bytes.
Global variables use 49 bytes (9%) of dynamic memory, leaving 463 bytes for local variables. Maximum is 512 bytes.
If you go to the FIle menu, Preferences item, one of the options there is "Show verbose output during:" with tick boxes for compliation and upload. If I tick just the upload box on mine then this is what is displayed in the black and white box (don't worry about most of it, the important bit is at the end where it says "avrdude: 2882 bytes of flash verified. avrdude done. Thank you."

Code: Select all

Sketch uses 2882 bytes (35%) of program storage space. Maximum is 8192 bytes.
Global variables use 49 bytes (9%) of dynamic memory, leaving 463 bytes for local variables. Maximum is 512 bytes.
C:\Users\Desktop\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Desktop\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -pattiny85 -cusbasp -Pusb -Uflash:w:C:\Users\Desktop\AppData\Local\Temp\arduino_build_324926/gyroMPU6050.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Desktop\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATtiny85
         Chip Erase delay              : 400000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e930b (probably t85)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: reading input file "C:\Users\Desktop\AppData\Local\Temp\arduino_build_324926/gyroMPU6050.ino.hex"
avrdude: writing flash (2882 bytes):

Writing | ################################################## | 100% 23.18s

avrdude: 2882 bytes of flash written
avrdude: verifying flash memory against C:\Users\Desktop\AppData\Local\Temp\arduino_build_324926/gyroMPU6050.ino.hex:
avrdude: load data flash data from input file C:\Users\Desktop\AppData\Local\Temp\arduino_build_324926/gyroMPU6050.ino.hex:
avrdude: input file C:\Users\Desktop\AppData\Local\Temp\arduino_build_324926/gyroMPU6050.ino.hex contains 2882 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 13.36s

avrdude: verifying ...
avrdude: 2882 bytes of flash verified

avrdude done.  Thank you.
If yours is saying that the flash verified, and you've definitely plugged the wires to the correct receiver channels, then I guess it is broken. No worries, I can send you another one if you wish.
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

Jeff (bluejets on the forum) has PM-ed me this nice schematic diagram. Thanks Jeff! :D I'll include it in the next revision of the "manual". Click on the schematic to see a clearer view - I think the inline version is being resized for display which makes it look blurry (on my PC screen anyway).

schematic.jpg
Post Reply