Saturday, August 30, 2014

Arduino + TFT LCD

I happened to find this 2.8 " TFT LCD on ebay here manufactured by a chinese company called ARMJISHU. The only way i came to know about this TFT was because of the fact that the manufacturers were generous enough to put their website url on the PCB silkscreen. If this detail would not have been there i would never have known what display driver chip it runs or what touchscreen driver it uses. If you head over to the ARMJISHU site it's all in chinese and i could not find this tft sold as a separate product. It was however sold as a part of their STM32 kit. It was in the CD for this kit (which was a whopping 1.2 GB download from the site) that i found the source code for all the peripherals used by the kit and in the tft example i found that the driver was a SSD1289 and a ADS7843 touch controller. 



Once you know the controller it is pretty easy to find the Arduino drivers for the same. I hooked up the tft to the Arduino MEGA and was able to run some sample code using the UTFT library. The touchscreen never worked with this library from elechouse. I am guessing it's damaged. I saw many posts on the internet about people not being able to use this TFT just because they could not find details about it. I hope this post serves as a reference, if they find this post ;)


 The connections for the ATMega 2560. The colored names are the pins on the TFT header. CS is actually named LCD_CS on the tft pcb. RD pin on the tft header has to be directly connected to 3.3V.


The output. Something does not seem right ? Can you guess the last number in the sequence ?

The hookup guide for the TFT using the Mega can be found in the UTFT pdf manual. The code i used is just the example available in the UTFT lib. One has to just uncomment the Arduino Mega API call and comment out the Uno one. The first parameter to the class variable declaration has to be set to the display model, in this case SSD1289.

Update
While using the ADS7843 library from the link mentioned above you might get some errors in ads7843.h like:

ads7843.h:34: error: ISO C++ forbids declaration of 'Pio' with no type
ads7843.h:34: error: expected ';' before '*' token

In order to fix this, open the ads7843.h file and comment out the line as shown below (the second line too
is of no use hence comment that as well)
 

Next, open ads7843.cpp file and disable the code shown below from the class constructor


The compilation should now be successful...

Visible Light Communication Chronicles - Part IV - The Photodiode

In this post i will compare the new ambient light sensor that i got - the TEMD 6200FX01 by Vishay to the TEMT 6000 phototransistor [PT]. The TEMD6200FX01 is a PIN photodiode [PD]. More information can be found in its datasheet here. The circuit i hooked up with the PD is shown below.






The PD is reverse biased with a voltage of 3.3V and the output is taken across the 10K load resistor. Looking at the reverse voltage vs capacitance curve from the data sheet i approximated that the diode capacitance will be around  30 pF. The load resistor and the capacitance will determine the cut-off frequency and the time constant. Based on above values these turn out to be as shown below


Hence the cut-off frequency happens to be approximately around 530 KHz with this configuration of the PD.
The LED was modulated with different frequencies and the light was focused on both the PD and the PT. The below waveforms were observed on the scope. The orange trace is the PT output and the blue trace is the PD output. (In case of the PT the circuit is same as before and the output is obtained across a 10K resistor). It was pointless to go beyond 10KHz as the PT output faded away.

100 Hz square wave


1 KHz square wave

10 KHz square wave


The board i designed for mounting the TEMD 6200 0805 SMD so that i could breadboard the test circuit


In the next chronicle i will be hooking up the PD to a transimpedance amplifier...

Friday, August 29, 2014

Arduino + WizNet Ethernet Shield + Xively

I got this WizNet Ethernet Shield that i wanted to try out with the Arduino since the CC3000s proved to be a complete disaster. The shield appeared to be of chinese make and quiet different from the original Arduino Ethernet shield. I stacked my Sparkfun Weather shield on top of it as shown below only to find out that there was no provision to connect the I2C lines from the Arduino. SDA and SCL were not brought out onto the ethernet shield. Even the IOREF pin was not connected which was not helping the weather shield as the temperature and humidity sensor were interfaced using I2C and also needed the reference voltage. Looks like i have to tryout the original arduino ethernet shield sometime which has the I2C header present.Anyways i can only acquire the light sensor data using sparkfun shield using the existing setup.


 The code for the same is as below and what i had shown in an earlier post. The temperature and humidity settings have been zeroed out. The data is sent out to the Xively website.

Alternatively to test how effective the ethernet shield was i sent a value of 0 and 50 alternatively every 2 seconds to the Xively website. The code for that is shown below. Also shown below is the screenshot from the Xively site displaying the incoming data in the graph. Ideally the graph is supposed to be a continuous " saw waveform". The gaps that you can see are the connection to the xively site failing. It takes some amount of time to get back online. But it does recover unlike the CC3000 that goes into some infinite loop. So, apart from the fact that the I2C is messed up, i kinda like this shield. I hope the guys who made this shield add those I2C headers.... :)


Thursday, August 14, 2014

Visible Light Communications - Lumia 920 Windows Phone + Galaxy S5 Android

While i wait for the components to arrive i am trying some new stuff using the existing setup. Here is how i implemented a VLC data transmitter using the Windows Phone 8.0 - A Nokia Lumia 920....

--- A few eons later ---

Well this just did not turn out to be good. I tried to modulate the flash of the camera on both the Lumia 920 Windows phone and Android Galaxy S5 with similar results - It Does Not Work !! The maximum modulation frequency i got was around 33 Hz for both the devices. I believe achieving higher data rates using onboard timer mechanisms of the OS just does not work. If you are reading this and are an expert on Android or Windows Phone Operating systems, i would be glad if you could give this a try or even sugesst me how to achieve high resolution timers that operate without giving any distortion / timing errors if i use them to modulate the camera flash. The image below shows the application. Turn On / Turn Off just switch the flash ON/OFF using the torch mode. Timed button activates a timer based on the DispatchTimer class. The time duration is taken from the Textbox. Similarly the Pool Timer button activates a timer created using the ThreadPoolTimer class.


As an example here is the code from my windows phone program. P.S - This code was adapted from several examples i found on the internet and after doing a brief study on the WP8 How Tos. I do not major in WP8 programming ;) So if you spot something wierd please let me know...