Wednesday, June 20, 2012

Handmade Arduino

When I first read about Arduino, I liked how compact it is, and how much processing power I can get. Also I loved the library and the idea of standard pins. I decided to buy a Mini-Arduino to play with. It costs me 160 L.E. in Egypt, that is about 27 USD. I decided to buy an ATMega 328 chip and try to imitate the board. I bought a crystal and couple of ceramic capacitors and some resistors, and started to build up an identical circuit.


Circuit Diagram using Fritzing 






My Actual Circuit identical to the diagram


 [extra wires you can see connected to Arduino are for AVR programming]



The end result is using ATMEGA-326 alone with nothing connecting to it except a resistor in the reset pin.

to make sure that they run at the same speed I developed a simple application that blinks the LED on a certain rate, and I uploaded the application to both chips using AVR. LEDs started to blink on the same rate.


Application Source Code



The good side is that the handmade version costed me only 40 L.E. which 6.67 USD only.
Application can be downloaded from here.

Monday, June 11, 2012

What is Inside Spektrum DX7 Receiver


In this document I try to go through my findings and my expectation of board structure and behavior. 




Overview
My Tiger Trainer plane was completely destroyed in a crash. Even the muffler and the receiver were destroyed. I took this as an opportunity to know what is inside Receiver DX7, and how much is it different than much cheaper receivers such as Orange Receiver.



Boards StructureAfter some investigation I came out with the following outputs:
1- The receiver of DX7 consists of two main boards attached to each other as in figure 1

Figure 1: DX7 Receiver Board

The two boards are:

a. The smaller upper board is the actual receiving board and has two antenna attached to it – one of them was detached in my plane crash-.
b. The bottom bigger board is the main board. It takes receiver output and decodes it and sends output signals through output pins to servos.




Figure 2: Block diagram of the main board of DX7


Things to notice on this board:


1- The first thing I noticed is that the satellite external circuit is identical to the receiver circuit –smaller upper board- inside the DX7 body. To prove that I took the receiver out and solder satellite circuit wires to pins where the receiver board was connected. When I turned on the receiver and the transmitter they could connect to each other.


2- There is three receiver points on this board. One in the middle where the main board connects, one on the left where the satellite socket exists, and another one on the right that is active but cannot be used unless you take the cover and solder your wires there.

I expect this will give extra coverage because you will be able to a receiver board for each dimension and you will cover reliably 3D, so whatever the position of your plane the link will be very reliable.


Figure 3: Main Board, and pin assignment of each receiver.



Figure #3 shows how receivers are connected to CY8C27443 microcontroller. 


Datasheet for this microcontroller can be found here 


Output Pins:

Throttle:   Pin 26     P0[6]

Aileron: Pin 4 -    P0[1]
Elevator: Pin 1 -    P0[7]
Rudder: Pin 24 -  P0[0]
Gear: Pin 25 -  P0[2]
Aux 1: Pin 3 -    P0[3]
Aux 2:      Pin 6 –   P2[5] 

What is can we conclude here is that the microcontroller receive signals from multiple receivers and determine which signal is valid. Then it simply converts serial data to PWM signal for each output. I found interesting topic here discussing details of this point by connecting satellite to Arduino http://www.dogfight.no/2011/01/spectrum-receiver-satellite-to-arduino.html


Orange Receiver


Although Orange receiver looks much more simple than DX7, but infact we can see many commons here. There is only two ICs the receiver, we should expect three here, but it seems that the second IC performs the decoding function as well, because at the end of the day they are microcontrollers and it is a matter of software updates.


The regulator is another difference, we have only one capacitor and a small regulator which gives an indication of the maximum current they can stand.



Another interested part I noticed is the signals that you receive from channels. Signals are originally send and received in series, then these signals are demultiplexed into their original channels. This means we never get any overlap between any two PWM signals   if we measure them from RX output channels. Channels can never overlap.
Throttle - ALI"green-red"
The above figure shows how signals Throttle and ALI are adjacent signals, but they never over lap, as we can see in the next figure
No Signal Overlapping
The same characteristics appears between ELE & Rudder signals, if you choose THR & ELE or rudder you will notice that the distance between these to signals are far.


If you are interested in more details about signal handling in your firmware and how to protect your quadcopter from losing TX signal while armed please check this link Receiver Handling and Signal Lost Detection Explained