Saturday, December 29, 2018

Setting up atmega328 and CP2102 USB Module

For a while I've been playing around with different arduino compatible cards. I've been using JOY-IT UNO, Nano v3.0 atmega328P with integrated USB and now the atmega328P Mini which needs external USB Module to upload your sketches. Setting up is a bit complicated so I'll write instructions here so it will be easier next time, or if someone else wants to do the same thing. 

First you need to get drivers for you CP2102 module as Windows does not recognize it automatically. Silicon Labs has universal drivers for different operating systems. 


After successful installation you can see the port in device manager. Then you need to setup you breadboard so you have USB Module correctly connected to your atmega328P card. 

Note that USB module I'm using has power connections for 5V and 3,3V. My atMega card is 5V version so I've connected VCC into 5V. Should you have 3,3V card, you need to use 3,3V connection. Also If you have a reset (RST) instead of DTR in your USB card, you need to modify connection a bit. 


When you are done with wiring, you need to setup your IDE to support you connected USB device. Connect the USB cable and make sure PWR lights on both cards light up.  

I'm using Arduino IDE, in which you need to go to "Tools" - menu. Select port: "COM7" or whatever your device installed into earlier. Select card: "Arduino Pro or Arduino Pro Midi" and processor: "ATMega328P (5V 16MHz)". Should you use 8MHz or 3,3V card, make sure you make a correct selection, there were 4 versions when I wrote this. 

When you are finished, use for example this faster led_blink sketch to test it:

void setup() {                
  pinMode(13, OUTPUT);
}
void loop() {
      digitalWrite(13, LOW); // LED off
      delay(100);
      digitalWrite(13, HIGH);// LED on
      delay(100);

}

Upload sketch into your card and voila, you have a really small arduino compatible card ready for whatever you are going to do with it.






Thursday, December 27, 2018

Configure Raspberry Pi+ 3 with 3,5" Touch Screen Display

I just got a cheap 3,5" Raspberry LCD that I ordered from eBay. It seems that when you get a bargain, you get what you order, nothing else. There was no instructions manual nor drivers with the display. Luckily there was a small label printed in LCD box with some information about it:
Driver: ILI9486, Dots: 320x480, Touch:Yes, SKU: MPI3501

After googling I figured out that it's most probably this display:
http://www.lcdwiki.com/zh/3.5inch_RPi_Display
and the drivers can be downloaded from here:
http://www.lcdwiki.com/3.5inch_RPi_Display
https://github.com/goodtft/LCD-show

After extracting the driver into:
 /home/pi/LCD-show

Open LXTerminal and use commands:
cd LCD-show
./LCD35-show 
and your Raspberry Pi reboots and starts with your 3,5" display.

From 3,5" display back to normal HDMI view open LXTerminal again and use commands:
cd LCD-show
./LCD-hdmi

Testing private Methods in C#

Testing private methods in a C# can be a bit challenging. This is just to remember what's needed. [TestClass] private MyUnit _myUni...