Showing posts with label mcu. Show all posts
Showing posts with label mcu. Show all posts

Wednesday, December 14, 2011

Android USB Host Testing.


Since Android 3.1.x (API Level 12), Google introduced an USBManager which is actually a USB host API to talk to usb devices connected to your tablet or phone. It is different to the Android ADK, which requires the other sides have special hardwares and software protocol.

As now your tablet/phone is a complete USB host device, so you can theoretically connect to any USB devices avaliable on the market. But you have to write your own USB driver using USBManager (Java) to talk to the devices.

There is a one example provided by Google called ADB Test, so now you can connect your tablet/phone to another android devices via USB and start debugging. (i.e. adb logcat)

Source code: http://developer.android.com/resources/samples/USB/AdbTest/index.html

I got a Asus Transformer TF101, and a special USB kit which turns the external connector to a USB host connector, so now I can connect my phone to it with the USB cable! Let's see the demo video here:


If you want try it on your tablet/phone, you need to prepare a special usb host adapter if necessary and then download the following from the market:
https://market.android.com/details?id=com.bitartist.usbadb

it is a direct copy of the Google Adb Test,  I put on market just for people to play around.

I have started a little project of interfacing a USB2Serial adapter (based on SiLabs CP210x chipset), so far I can send / receive the data to/from the MCU UART. I hope can finish some basic functions (like setting baud rates) and release it to public later. It is a simple and cheap way to connect your Android devices to your MCU, the only drawback is that you will need a usb host and Android 3.1.x host device.





Wednesday, May 19, 2010

Android & Bluetooth module.




Android phone is becoming more popular, most of the android phones equipped with Bluetooth. Just wonder how we can make use of the powerful android phone to interact with MCU like Atmel AVR, PIC or even Arduino. I think that more interesting projects can be done with the bluetooth connectivity to Android:)

After some studies, I found out that in Android 2.0, Google enhanced the Bluetooth API and come with an Bluetooth Chat sample for communicating devices with RFCOMM (SPP profile). So I did a try and it really works very well!



Let's try it out! The Bluetooth module that I used is a very tiny one with PCB antenna, it can control device over 10 meters at least, good enough for small project:) It is programmed to use as RFCOMM, so it can act as a wireless UART, good fit for all the MCU! With only 4 wires, 3.3v/Gnd/Tx/Rx, no programming needed, you can directly connect the module to your MCU UART.


Here is my demonstration video:


For the bluetooth sample code, you can find it in the Android SDK or here.

Saturday, February 20, 2010

DIY Hobby center GRAND opening in Philippines

My friend, Dandy, opened a DIY Hobby store in Philippines! He is selling 8051 starter kit, home automation kit and also satellite DIY kit. Recently, also start selling ARM9 (S3C2440) based development platform "FriendlyARM". The basic kit comes with 3.5" LCD, with 400MHz ARM9, which is capable of running Linux and also Android! Check out some photos here:





You can see the FriendlyARM with 7" LCD in this photo, it is really cool! Once installed the Android, you can open the WebKit browser and surf the net with Wifi.


Congratulation to him, and please check it out if you live in Philippines!
Location:http://www.electronicslab.ph/forum/index.php?PHPSESSID=d6fedf7919a33df34ad9b6e65a6caf3f&/topic,15240.msg265515.html#msg265515

Monday, July 6, 2009

Motors control with MCU.

Guys from Nerdkits.com, presents "Motors and Microcontrollers 101". The tutorial covers some basic idea of motors:


Check out the complete tutorial here:
http://www.nerdkits.com/videos/motors_and_microcontrollers_101/

Sunday, April 5, 2009

LED Driving without resistor.


Tinkerlog just posted an in-depth study on what situration that the current-limiting resistor can be omitted when driving a led. If you want to save PCB space or just lazy like me, not going to add a current-limiting resistor between your MCU output and LED, you should defintely to have a look on his study!

Link:
http://tinkerlog.com/2009/04/05/driving-an-led-with-or-without-a-resistor/

Tuesday, March 24, 2009

XGameStation - AVR 8-bit Development board - Create your own console game!

XGamestation sent me a link about their new AVR 8-bit Developement kit, XGS AVR 8-Bit Development System. After reading the details, I am impressed. The DIY video console game is nice, and showed me how the AVR 8-bit processor can be optimized to do complicated image processing(So far, I only use AVR for small project!). Let's take a look on the video demo first:






The kit includes:
1) XGS AVR 8-bit development board (VGA output, NTSC/PAL output, game controller(NES) port, PS/2 port, SD card slot, power regulator, serial port, audio output etc.)
2) AVR USB MKII ISP programmer
3) one NES clone gamepad
4) 1G MicroSD
5) DVD (includes all the codes, manuals to kick start)

One thing want to emphasis is the Ebook "Inside the XGS AVR 8-Bit" come with the kit, it is a comprehensive guide of programming AVR and also game console programming. If you are very interested on how the game console works, it is a good book for you too.


See? It is a complete kit for game console programming, it costs $139.95, you can buy it here: http://www.xgamestation.com/view_product.php?id=46&mid_img_index=0

Let me know if you make some cool games! I am pretty busy recently, otherwise, I really want to have a try! and write you an in-depth review on it!


Any cool site or kit to suggest to me? Just fill out the form here: Suggest to me I would be happy to take a look!

Sunday, January 4, 2009

How Microcontroller BootLoader works?



Brumbarchris wrote an interesting artcile about MCU bootloader, it is time to read some techincal stuffs.
Read it

Monday, August 11, 2008

AVRtv youtube channel.

Just came across a AVRtv channel on youtube, it is the ATMEL AVR marketing channel for promoting new microcontrollers, recently playing XMEGA, and also the new UC3 series.

Check it out!


Links:
http://www.avrtv.com/

http://www.youtube.com/user/avrtvtube

Sunday, July 6, 2008

CTC mode on Tiny13

There are two OC0A and OC0B compare outputs in Tiny13. It is useful to generate waveform . In this example, we use OC0A to output a square wave to blink the LED which is very similar to the previous timer interrupt example instead the output is generate inside Tiny13 but not our interrupt routine.

int main (void)
{
b0_output; //OC0A as led output

TCCR0B = 0x03; //select timer clkio/64

TCCR0A = (0x01)<<6 | 0x02; // Toggle OC0A | CTC MODE
TCNT0 = 0x0; //starting couter value

OCR0A = 0x7F; //around frequency @ 2.2HZ

//make the clk cpu slower
CLKPR = 1<<CLKPCE; //tell cpu to update the CLKPR

CLKPR = 0x8; //clkio = clkcpu/256


while(1) {
;; //interrupt do the rest
}
}

We set the output to be toggled every time the counter value match our OCR0A value. Thus, a square wave is generated:



The complete project can be found here: http://labs.bitartist.org/compare_int.tar.gz

Timer interrupt on Tiny13

Sometimes we have to do somethings in certain period, so timer may be useful for you.
AVR tiny13 have one timer and it count until to 0xFF value for each clock. An interrupt will be then generated and call your interrupt routine.

In our example, we have the following interrupt routine:

ISR(TIM0_OVF_vect) {
if (led){
b0_high;
led = 0;
} else {
b0_low;
led = 1;
}
}


This routine is used to toggle the LED On or Off.

The complete project code can be found here: http://labs.bitartist.org/timer_int.tar.gz

Testing external interrupt INT0 on tiny13

Tiny 13 have an external interrupt "INT0" on PB1, We have created a test project on avr-gcc to have a quick testing on the INT0.



#include <avr/io.h>
#include <avr/interrupt.h>
#include "pin_macros.h"

unsigned char led=0;

ISR(INT0_vect) {
if (led){
b0_high;
led = 0;
} else {
b0_low;
led = 1;
}
}

int main (void)
{
b1_input; //switch
b0_output; //led output

MCUCR = 1<<isc01; //set INT0 as falling edge trigger

GIMSK = 1<<INT0; //enable INTO in global interrupt mask


sei(); //enable interrupt

while(1) {
;; //interrupt do the rest
}
}



B1 is connected to a switch, and B0 is connected to a LED.
When B1 is pressed, it would toggle the LED On or Off.

Download the whole project : http://labs.bitartist.org/test_int0.tar.gz

Reference:
http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html

Sunday, June 29, 2008

Gif2led released, and with AVR LED Egg demostration!

We have worked on LED matrix for so many times, but mostly for text scrolling, so how about make some animations on it? But we are too lazy to make the animation patterns to the C header file in an array of bytes. We finally finished one tool may be useful for all led matrix lovers!

The gif2led project is written in Ruby, required Rmagick library for gif manipulation. It is mainly designed for 8 or less columns matrix, for instance 8x8 matrix, 10x8 matrix, 5x7 matrix etc. It output an pattern header file with a 2D array frame by frame from an animated gif input. We only tested with AVR-gcc, but it should be useful for other MCUs too. You can find more information on the gif2led project page, http://labs.bitartist.org/gif2led/

Let start with our demonstration, the project is called LED Egg, it is based on a 10x10 matrix (but we only use 10x8 in our case) with an Egg case to hold the circuit board.

To prepare the animated gif, we use macromedia Flash, and here is the screenshot:



Noted that the frame 0 (marked as CAL above) is a special frame, which used for calibration. When used with gif2led tool, the frame 0 is the pattern of your led matrix with all led ON.

and then export the movie to an animated gif:



Then simply run the following command, we can obtain the 2D array header file:
ruby gif2led pattern.gif 20 > pattern.h
//selected ratio is 20.0%
//Cal result: LED Matrix (row*col) = (10*8)
const unsigned char pattern[63][10] PROGMEM = { //Frame 0 {0x42,0x00,0xa5,0x00,0x84,0x21,0x00,0x42,0x21,0x84} //Frame 1 ,{0x00,0xa5,0x00,0x84,0x21,0x00,0x42,0x21,0x84,0x42}
...
...
#define MAX_FRAME 63
#define ROWS 10
Now, we have to prepare the circuit part, we use AVR tiny13 together with 4017, please refer to the circuit diagram<here>. 4017 is used as a row counter, and such that we can only use 1 pin for row shifting. The remaining 4 IOs of the tiny13 would use for column output, we are using 10x8 matrix this time, so we assume the pattern is symteric to save pins, so 1 I/O drive 2 columns in our case. The circuit showed below:



So Lets add an egg case, the egg is made from pu foam plastic, it is used for Easter decoration.





Video demonstration:


Close look on the LED pattern:



To download the gif2led tool, AVR source codes, and flash template, please find in the following links:

Gif2led project page:
http://labs.bitartist.org/gif2led/


Gif2led Rubyforge page:
http://rubyforge.org/projects/gif2led/

Saturday, June 14, 2008

The Propeller Clock (POV clock)

Just come across this cool video of a DIY propeller clock, it is based on the concept of POV system. The basic components are motor for spinning, LEDs for display and the microprocessor for the main control. Please take a look:

Sunday, March 2, 2008

Small 5x7 Dot Matrix LED display

What is 5x7 dot matrix display?


5x7 dot matrix Led display is usually used to cascade together to make a large led matrix display as you see in train station.


(A typical LED matrix display)

The small size of 5x7 dot matrix led display is good for small electronic project, typically the 5x7 dot matrix is used to display one character a time, i.e. 5x7 dot matrix font. In order to use only one 5x7 dot matrix to display information, we have to use the 5x7 dot matrix horizontally. We use the 5x4 dot matrix font instead and of course text scrolling will be necessary.

The KAAS Led flower vase is using the 5x7 dot matrix display for displaying messages.

kaas used one AVR tiny13 and two 74hc595 chips to drive the led matrix, the result is very impressive. The detail information of the LED flower vase is here.

Another interesting project is the Twitter LED scroller Build from davidnin. He used the Arduino board and one 74HC595 to drive the 5x7 dot matrix led. Please check out the cool video:

Another project from us, GIF2LED!
it allows you to convert a gif animation to LED header file to speed up your coding time:)

Check it out:
http://www.bitartist.org/2008/06/gif2led-released-and-with-my-led-egg.html


Another cool tiny message scroller using ATtiny2313 from kalanda:

http://www.kalanda.com/scroller-de-7x5-leds-basado-en-micro-attiny2313.html




Wednesday, February 20, 2008

The wireless rabbit: Nabaztag

What is Nabaztag?

The cute wifi rabbit is another internet widget device, it connects to the community server online and user with the rabbit can use it as a medium to communicate. Sounds funny when you have a group of friends with the rabbit at home. The wireless rabbit can move its cute ear and also light up the RGB leds inside to express the feeling and mood. It is capable of using as Alarm clock, weather reporter and RSS feed readers.

The Internal

What surprise me is the hardware inside. The rabbit is using a PIC18F6525 MCU and a PCMCIA BenQ 802.11b wifi card. It is not so strong as I guess. The network software stack is done on the PIC including the TCP/IP stack and the 802.11 stack. It is hard to imagine to get all these stacks on a PIC, so they did it. One similar cool project I found is the WLAN for AVR project, I will consider to use uClinux if the cost is not really an issue:)

Some internal photos by Pokie


External Links

Official Site: http://www.nabaztag.com/
Community Site: http://my.nabaztag.com/
Rabbit tear down photo: http://pokie.dyndns.org/photos.php?album=nabaztag&page=1

Monday, February 18, 2008

Information on Integrated Circuit/IC Packaging.



Integrated circuit is the key component of every electronic project, it can be simple as logic gates, counter, multiplexer to highly complex microprocessor. When you buy IC online for your project, the same IC may have different packages, you have to choose the right package type for your prototype. For example, DIP, PLCC, BGA etc. This website (Integrated Circuit, IC Package Type) gives you a list of common package type definitions, you can get more information there. For me, I usually make my project on the wooden prototype board, so surface mount package type is not prefer unless I make the PCB myself. I usually used the DIP package for the microprocessor(MCU) and also the other IC, like 74HC595 and 555 Timer. It is easy for soldering and also wire wrapping.


#1 - Transistor with TO-92 package


#2 - MCU(AVR tiny13, DIP package) contains in a plastic tube.


#3 - 74HC595 IC in DIP package plugged into the wooden prototype board.

If you really want to find in depth information of the IC packaging type, please visit this website: Discrete Packaging (Fairchild Semi)