Home » Projects » Software Projects » Page 4

Category: Software Projects

Arduino AD9850 Rotary Encoder Commands

ky040As described earlier, my signal generator is controlled by LCD Keypad buttons and a rotary encoder. The KY-040 rotary encoder is cheap and reliable. You can buy them on eBay for around a dollar each and you should always keep a few around.

Rotary encoders are used to send tuning pulses to an electronic device. Your car radio probably uses rotary encoders for changing volume and frequency. They work by sending pulses when turned. These pulses are on two channels (A and B) and are sent 90 degrees out of phase with each other.

Read more

Arduino AD9850 Control – Reading Button Commands

The main program loop for my Arduino AD9850 control program begins by checking for button commands from the LCD 1602 Keypad. Then it moves on to checking the status of the KY-040 optical encoder. The encoder outputs are translated to equivalent button commands, depending on the direction of turn and closing the push switch. After this, the program moves on to processing the button commands, which tell the signal generator what to do.

void loop()
	int btn = BUTTON_NONE;

	* Get the Inputs. Priority given to LCD Keypad buttons.
	* Turning encoder produces BUTTON_UP or BUTTON_DOWN
	* Pressing encoder switch produces BUTTON_SELECT or BUTTON_SELECTLONG
	btn = ReadLCDBtn();
	if (btn == BUTTON_NONE) {
		btn = CheckEncoderTurning();
	if (btn == BUTTON_NONE) {
		btn = CheckEncoderSwitch();
	/* Deal with Menu activities, if any */
	btn = ProcessMenu(btn);


Read more