Keeping balance with a gyroscope

The little smaller one works directly. You can read the x y z, values directly from the analog inputs and this one you connect through I2C, so before Ill, make two seperate videos of each sensor.. lets, try to combine both and see which one works best. Of course, we need an Arduino, an Arduino Nano, because it it very breadboard friendly and we place both sensors on it. What have both in common, of course, ground GND everything needs ground, connect it to a ground. Rail ground is here on the left and here on the right. What do we need next VCC Ive checked it and both can handle 5 volts. So we are using another ground, rail and 5 volts from the Arduino. I hope the Arduino can power both. So now the rest, we will connect this one first, because this one needs I2C and the I2C pins on the Arduino are predefined, its analog A4 and analog A5. This pins, we cannot use for the GY 61 sensor. The clock line is analog 5 SCL data line. Sda is analog 4. On this sensor we have 3 analog outputs to wire up x, y and z. Lets just use analog 0 to 2 or analog 1 to 3. Its more obvious uhh..this looks nasty. The main difference between those sensors is how much code they need to operate luckly for the GY 291. There is, of course, a library and, of course, an Adafruit library, but youll find it under the name ADXL345.

Its the chip that is mounted on the sensor – and you can see here, is the marking, for it not sure if you can read it. So there is quite a lot going on here and I dont think we need to go through this, but I think we should see the results yeah. It really seems to work, easy and quite accurate, and the advantage is that you get real sensor values. So lets see what its little brother will put out. The GY 61 is pretty easy. You see the whole code fits on one screen, you define where you connect the three outputs in the setup. You define these pins as an input, although there isnt really a need to define a analog pin as an input because it is default set as an input and in the loop. You read the sensor values and do whatever you want with it. So.. uploading it and, as we can see.. this sensor also does the magic trick. If you now ask which sensor you should use in your project… Well, if you want to build your own quadcopter.., you should definitely go for the ADXL345 or aka GY 291, because it has an I2C bus and if you want to build a quadcopter, you definitely want to minimize the pins you use, but for smaller projects. If you dont have much ram left, for example, if you want to combine it with those Digispark ATtinys, this one has 3 analog inputs actually 4, so it would fit the recommendations to read this sensor values and you dont have to implement any librarys any fancy code.

You just have to read the sensor values and handle it. Although the sensor values of the smaller brother dont really say anything, the library for the bigger one works pretty well and youll get sensor values that you can really use for positioning quadcopers or any other project. I guess for my needs.. I really could use those ATtinys and I will try if I can work with this one, because the code is quite easy and I really dont need those exact values. This sensor will give me, so I hope you liked this video. Maybe you learned something from it: thumbs up share subscribe.

Share.
Exit mobile version