Showing posts with label Electronics. Show all posts
Showing posts with label Electronics. Show all posts

Friday, January 10, 2020

Getting Started with FRDM-K82F

FRDM-K82F is a low cost development platform using MK82FN256VLL15 microcontroller. When I started using the board according to its getting started guide at

Get Started with the FRDM-K82F [NXP16],

I found out that its out-of-box demo is not running on my version of FRDM-K82F board. The insturctions on that page are also out of date. And, I could not get it worked.

After spending my time testing, browing the Internet, and experimenting, I found out that the following things might be necessary, in a brief, to make the board worked.
  • Debug adapter - update it
  • IDE - use MCUXpresso instead of Kinetis Studio
  • SDK - use MCUXpresso SDK Builder (make sure to 'drag and drop')
  • Flash - unlock the MCU's flash if required



Figure. FRDM-K82F board.


Friday, November 23, 2018

Using Parallel Port on Linux with C++

Example programs for using parallel port on Linux [Lin15a,Coo08a], and a C++ class library can be found at the following link.

https://github.com/yan9a/cecpp/tree/master/parallelport


Figure 1. wxWidgets example using paraller port as digital output and input.


Saturday, August 11, 2018

DIY Programmable Function Generator Using Arduino Uno

It is possible to use Arduino Uno as a function generator to produce low frequency waveform. The advantage of the approach is the possibility of producing customized, complex, time varying waveform. On the down side, it cannot produce waveform with very high frequencies. To get smoother waveform, the PWM output frequency of pin 3 of Arduino Uno is increased to approximately 8 kHz. It is also possible to use DAC to achieve better results.


Figure. The output of Arduino function generator measured with an oscilloscope.


Thursday, July 7, 2016

Motor Driver - DRV8834

I am designing a motor driver to drive a stepper motor AM1020-V-6-65. At first, I thought to use A4988 from Allegro. But its supply voltage of 8V - 35V is not suitable for a 6V motor, its chip size 5 mm x 5 mm is bigger than what I want. DRV8835 from TI has appealing 2 mm x 3 mm size but it is meant for DC motor and there is no indexer to support convenient control of stepper motors. Finally, DRV8834 with 4 mm x 4 mm size, motor supply voltage 2.5V - 10.8V, and current 1.5A per coil is chosen.

Thursday, May 5, 2016

DRV2700 Piezo Driver

DRV2700 is a single chip Piezo driver which is 4 mm x 4 mm x 0.9 mm in size. It can be used in 100 V boost or 1 kV flyback configuration. Supply voltage is 3 V - 5.5 V. In this article, evaluation of DRV2700EVM module is discussed.


Figure. Testing DRV2700.


Tuesday, April 12, 2016

Using 3rd party CC2530 modules

I would like to talk about 3rd party CC2530 modules - ( a first one and a second one ) that I bought from Aliexpress. In a previous article, I talked about CC2530DK from TI. In this post, using SmartRF05EB to debug 3rd party module is discussed.

Figure. A small CC2530 module whose size is 13 mm x 18 mm.

Thursday, March 24, 2016

Gyroscope L3G4200D

L3G4200D is a MEMS ultra-stable three-axis digital output gyroscope made by STMicroelectronics. A L3G4200D Module in Aliexpress costs only about $3.


Figure. L3G4200 Gyroscope module


Friday, January 1, 2016

Mesh Bee - JN5168

Mesh Bee is a 2.4GHz wireless transceiver mady by seeed studio. It uses JN516x wireless chip from NXP. It is open hardware, open source. The IDE and tools from NXP are also free.

Wednesday, November 25, 2015

Tuesday, November 24, 2015

Wireless Communication using CC2530 Zigbee Wireless MCU

CC2530 is an system-on-chip (SoC) solution for IEEE 802.15.4 and Zigbee that combines RF transceiver and 8051 MCU. To develop a wireless module using it, we had bought a CC2530DK devolopment kit that consists of 2 CC2530EM Evaluation Modules, 2 SmartRF05EB Evaluation Boards, and a CC2531 USB Dongle. It cost about USD 400. At first, we installed SmartRF Studio which was available for free at TI's website.

CC2530DK

Saturday, September 19, 2015

Controlling Your Hardware from the Web Using Arduino

Using Arduino Ethernet shield 2 to control a hardware from the web is discussed. Arduino Ethernet 2 Library is used to implement in an Arduino Uno board as a server in an example as well as a client in an another example. The latest version Arduino IDE ( 1.7.6 in our case ) is used in the following examples. An Arduino Uno board with Ethernet shield 2 is shown below.


Figure. Arduino Uno paired with Arduino Ethernet shield 2.


Thursday, September 10, 2015

Accelerometer LIS3DSH

LIS3DSH is an 3-axis MEMS accelerometer made by STMicroelectronics. Its full scale range is selectable from ±2g to ±16g. The size is small and it is only 3mm x 3mm. Either SPI or I2C can be used to interface with it. Supply voltage is from 1.71 V to 3.6 V. In this article, testing and evaluation of STEVAL-MKI134V1 adapter board is discussed.


Figure. STEVAL-MKI134V1 - LIS3DSH adapter board for standard DIL24 socket.

Tuesday, August 4, 2015

Bluetooth Module to be Used with Microcontroller

HC-05 Master/Slave Bluetooth Module is a cheap (~SGD 16) and easy to use Bluetooth module with UART interface. Interfacing and using HC-05 with Arduino Uno microcontroller to control an LED light as commanded by a hand phone via Bluetooth communication is discussed in this post. In fact, any microcontroller with UART interface can be used with it.


Figure. HC-05 Bluetooth module with Arduino Uno.


HC-05 uses 3.3V for its digital logic pins while the voltage level for Arduino Uno is 5V. A bi-directional logic level converter can be used to interface them. But, here, we just use simple voltage dividers using readily available components in our labs to interface them as shown in the following diagram.

Figure. Interfacing HC-05 Bluetooth module with Arduino Uno.


To communicate this Bluetooth module from an Android phone, we can search and use any 'Bluetooth SPP' app in the Play store. We have used 'Bluetooh spp tools pro' by Jerry.Li. After opening the app and scanning for Bluetooth devices, you can connect HC-05 using '1234' as the pairing pin. Thereafter, characters sent to RX pin of HC-05 UART will be received by the phone and the characters sent by phone will be output from TX pin of UART of HC-05. If you connect the Bluetooth module using computer instead of the phone, a serial port will appear in your computer which can be used as a normal comm port sending and receiving data to and from the Bluetooth module.

#include <SoftwareSerial.h>
#define RxD 2
#define TxD 3
char recvChar;
SoftwareSerial blueToothSerial(RxD,TxD);
void setup()
{
    Serial.begin(9600);
    
    pinMode(RxD, INPUT);
    pinMode(TxD, OUTPUT);
    blueToothSerial.begin(9600);

    pinMode(13, OUTPUT);
}
void loop()
{  
  if(blueToothSerial.available())
  {
      recvChar = blueToothSerial.read();
      Serial.print(recvChar);
      if(recvChar == '1') digitalWrite(13, HIGH);
      else if(recvChar == '0') digitalWrite(13, LOW);
  }
  if(Serial.available())
  {
      recvChar  = Serial.read();
      blueToothSerial.print(recvChar);
  }
}


This Arduino program forwards the characters sent by phone to the serial monitor and vice versa. It turns on or off the LED which is connected to the pin 13 of Arduino Uno microcontroller board when 1 or 0 is sent from the phone. The push button on HC-05 Bluetooth module needs to be pressed to send AT commands and to configure it.

Figure. Sending and receiving characters to and from the Bluetooth app using Serial monitor.


Another Bluetooth module called Bluetooth Shield is also tested. That module is designed for Arduino Uno and can be directly fixed on the Arduino Uno board. Therefore, no additional interfacing or connection is needed to make it work. But you need to make sure that the jumper settings are correct. As shown in the following figure, the jumper for HBT_TX is connected to D2 pin of the Arduino Uno board and HBT_RX is connected to D3. Therefore, D2 needs to be configured as RX pin and D3 as TX pin respectively in the demo program which is available at Bluetooth Shield Wiki page. You can define Bluetooth device name and pairing pin in that example program.

Figure. Bluetooth Shield.


Thursday, March 6, 2014

Reading Rotary Encoder Using Microcontroller

Rotary encoders are commonly used for measuring angular position or motion sensing. An optical encoder has a disc with a pattern of cutouts. As the disc rotated, an LED light that shines on photo detector is turned on and off accordingly to produce a digital waveform.

An optical encoder produced by VEX Robotics Design System

Gray code is normally used in encoders instead of ordinary binary code to prevent glitches. In Gray code, the number of changing bits between successive numbers is only 1. The following table shows 2 bit Gray code from 0 to 3.

Monday, July 8, 2013

CAN bus

CAN bus (controller area network) is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other. CAN bus is a message-based protocol, designed specifically for automotive applications but now also used in other areas such as aerospace, industrial automation and medical equipment. The advantages of CAN bus compared to RS232 communication are as follows.

Friday, June 28, 2013

Using Analog to Digital Converter of AT89C51CC01 Microcontroller

Using AT89STK-06 starter kit, I have written a few C code to read an analog to digital converter (ADC) input of AT89C51CC01 which is an 8051 microcontroller. It has 8 multiplexed ADC inputs with 10 bit resolution. As an example, ADC input pin 7 which is connected to a variable resister is read.

Thursday, February 28, 2013

Non-inverting Amplifier Using op-amp

When PiezoDrive PDX 150 amplifier that I used to drive a piezoelectric actuator was damaged, I need to find a way to use an existing spare amplifier. The spare amplifier shown in the following figure has input voltage -2 V to 12 V and output voltage -20 V to 120 V. Its gain is only 10 while the damaged one is 20. Therefore, I decided to design and use an additional preamplifier with gain 2.


The input to that amplifier is -1 V to 6 V and its output shold be -2 V to 12 V. Since I need non-inverted output, I have used an op-amp with non-inverting configuration. I have also used a trimmer so that it is possible to fine tune the gain. Readily available LM358N op-amp IC is arbitrarily picked up. The schematic circuit diagram and resulting amplifier using available components in our lab is shown below. Since the non-inverting amplifier has very high input impedance, I have used additional 56k resister to prevent it from floating.


When tuning the amplifier to get exact gain of 2, it looked unreliable to use peak to peak readings from oscilloscope. That was why, I had to think of an alternative way to achieve it. I set channel 1 which was connected to output of the amplifier to 10 V per division and I set channel 2 which was connected to input of the implifier to 5 V per division. After that, I calibrated the trimmer to get identical waves at the screen :P

Wednesday, February 6, 2013

TRIAC Power Control Circuit

My vacuum cleaner was faulty. I thought the reason might be blown fuse and I tried to fix it. Unfortunately, I could not find any fuse either in machine or connector. I then thought that the reason might be the faulty power control circuit. Therefore, I tried to bypass the control circuit by directly connecting power and motor. But it did not work. Finally, I successfully solved the problem by throwing the old one and buying a new vacuum cleaner :P I kept the power control circuit and tried to trace it when I was free. It uses a simple RC circuit and a DIAC to make a phase lag in firing the TRIAC. The circuit is quite simple and it is shown below.