AtTiny Arduinos. WireLibraryDetailedReference. An indepth reference to the Arduino Wire library.
Greetings, fellow Arduinoid! GreyGnome here. The Arduino Wire library documentation is notoriously stingy in details. Nowhere does it explain its relationship to the twi library of the avr-lib, and worse, to the TWI hardware in the ATmega chips. This reference attempts to fill in the gaps and give the Wire library the documentation it needs and deserves. Throughout the exploration of the code and the design of this document, this author has used the Arduino Duemilanove, based on the ATmega328 datasheet.
This discussion is based on the ATmega328 datasheet, revision Rev. 8271C – 08/10. View topic - Position Hold with Optical Flow sensor - done. Info for accessing G-Force/Airspeed/Altitude sensors with your microcontroller - Page 5. It cost me my weekend, but I have a reading out of the sensor, and seeing this data actually made me ecstatic!
Thanks to you all for your contribution in this thread, I would never have done it on my own! I interfaced the altimeter sensor with an Arduino board, using the wire.h library. Here is the code, as it might be of interest for someone, who knows: #include <Wire.h> #define ALT_ADDRESS (0x74) boolean DEBUG = true; #define I2C_WRITE_BIT (0x00) #define I2C_READ_BIT (0x01) void setup() { if(DEBUG){ Serial.begin(9600); Serial.println(ALT_ADDRESS); delay(2000); } Wire.begin(); } void loop() { altitude = read_sensor(); if(DEBUG){ Serial.println(altitude); delay(200); } } int read_sensor(){ int data = 0; Wire.beginTransmission(ALT_ADDRESS); Wire.send(I2C_WRITE_BIT); Wire.endTransmission();
How To Read RC Receiver PPM Stream. Many RC Transmitters and Receivers provide access to the PPM Stream, this is a single stream of pulses which includes the information for all of the receiver channels in a single connection.
This stream can often be accessed by removing the receiver case and adding a single wire to an existing connection within the receiver. If we can gain access to this stream we can write smaller, faster code and only need a single interrupt pin to read all of the receiver channels. Using a single built in interrupt to read multiple channels is much faster than using pin change interrupts which leads to a visibly smoother output signal for your servos and ESCs. This post concludes with a library which can be used to read a PPM stream using a single interrupt. The same library is also able to output upto 18 servo signals from a single Arduino UNO with no additional components. Scroll down for a video of the library and an RC Receiver hack in action - What does the PPM Stream Look Like ? Example PPM Hack - 1.
Arduino Servos. I've been building both AutoPilots, and QuadCopters, and I wanted to drive more servos and Speed Controllers with less jitter.
So I used some ideas from the Paparazzi gang and developed a way to drive up to 10 servos with just 2 output pins from an Arduino or ATMega8. The design uses just one chip, a Johnson style Decade Counter, and requires only two output pins from the Arduino. The Arduino uses one PWM pin (pin9), and one general IO pin (pin8). All the pulses are generated in sequence on the PWM pin, then spread out to the individual servos via the decade counter. The decade counter costs 63 cents. Now I can build Hex-Copters without having to use I2C ESCs, and still have servo outputs available for camera controls. Click here to download source code for Arudino Click here to download source code for AVR and ATMega8 chip.
Another issue has been jitter and resolution. Elevon / V-Tail mixer with Arduino Pro Mini 5V. I got this new and and really handy r/c transmitter from multiplex: the SMART SX.
It's really a minimal approach. I have been a fan of multiplex for a long time because they have always been pioneers in their domain. This one is the first quality r/c transmitter with a gamepad layout (there are many technical features other will copy sooner or later but I bought it because of the layout primarily). However, this being an entry level transmitter it is really limited in functionality. It has all the features a modern transmitter needs to have, configurable through 1 (yes ONE) button! However, Elevon/Y-tail mixing isn't a feature baked in. A 15$ Arduino Pro mini 5V seemed to be suitable (although overkill, I just needed something in a short time). Code. DIY simple and inexpensive Arduino-based sailplane variometer. Discussion DIY simple and inexpensive Arduino-based sailplane variometer This is my second vario design.
The previous one was expensive and bulky. Also the pressure sensor used turned out to be sensitive for RF. This one has no such problems. This is the best investment I have done regarding sailplanes. Any AM/OOK TX/RX can be used, but I had most success with the 433MHz modules from RF-Solutions.