Δευτέρα, 11 Μαΐου 2015

8x8 Matrix Controlled by Bluetooth

Maybe the hardest project I made so far. Based on the idea of embedded lab, I wanted to make it from the first time I saw it (http://embedded-lab.com/blog/?p=9255). There were two problem though! First of all the code works perfect but the hardware part had some errors and these errors gave me a bad headache. I don't think it was his intention to have errors but it took me lot of time to find them and gave me a chance to see how 8x8 works (well the hardware part I still luck in experience in the programming part :) ) Second problem was that jollifactory maybe a similar project with bi-color matrices (http://www.instructables.com/id/7-Bi-color-LED-Matrix-Scrolling-Text-Display/) and I like it a lot also. So I started building the second project, finished all the hardware parts and transfered the code to arduino but it didn't work as I wanted, after a lot of search, study and "trial & error" the answer to my problem came, it was the programming part, nick from jollifactory (who is a wonderful guy and helped me a lot with my questions) had made the code only to work with bi-color matrixes and it needed major modification if I wanted to work only with red matrixes. So I went back to the first project of embedded labs. 3 problems I encountered and it took a lot of time especially "waiting time" since the first 8 matrixes were common anode as he suggests but the project works with common cathode matrixes!!!

So let's start, these matrixes are 8x8 5mm and common cathodes this mean they have the code letter (A) and you can find the difference from common anode because common anode have the code letter (B), so in my project I ordered 8 pieces of 2088(B)S (common anode) but the project needed 8 pieces of 2088(A)S (common cathode).

Matrixes come in various sizes but I wanted as bigger it could be and 5mm is the ideal one, the problem here is that the boards with the chip max7219 (driver chip) come with the premise we will use 3mm matrixes, so I had to figure a trick to connect the 5mm matrixes with the small boards...

After these modifications we chain our 8 matrixes together meaning that the Dout signal of the first goes to the Din of the second, the Dout of the second goes to the Din of the third e.g. till the last one.we also connect CLK,CS,V++, GND together. V++ is 5V and GND is the ground. now we have 3 more pins. CLK which is the clock connects to pin 13 of arduino, Din of the first module connects to pin 11 of arduino and DS (or LOAD) connects to pin10 of arduino. A useful idea would be to connect 3 resistors of 10k from pins 10,11,13 of arduino to ground, with this trick our matrix won't get "garbage" from outside. Also we can connect a resistor of 1K between pins RX and D2 of arduino, this will be a hardware delay for out marix, so it can forestall our bytes when thay re being sent by our phone. Finally it's the bluetooth module which is being connected to 5V,GND, Rx of bluetooth connects through a voltage divider to pin Tx of arduino, and Tx of bluetooth connects to Rx of arduino. Upload the code and you are set to go. The app we use is Bluetooth SPP tools pro.  The config of the program is easy and with 10' of searching you will be able to understand how the program works.
commands : 

  • (message) the scrolling display must be sent inside a parenthesis
  • /p  to pause the scroll. Sending it again will resume the scroll
  • /<  scroll faster
  • />  scroll slower
  • /e  to erase the display
  • /+  to increase the brightness level
  • /-  to decrease the brightness level
 For the working of the matrixes we have to download these 2 libraries :
Mark Ruy's max72xx Panel
Adafruit's GFX Libraries

Finally here is the code :

Don't forget to visit this site for extra informations of this incredible project !

(message) – The scrolling display message must be sent enclosed by parenthesis. - See more at: http://embedded-lab.com/blog/?p=9255#sthash.yRMeEzfv.dpuf
  • (message) – The scrolling display message must be sent enclosed by parenthesis.
  • /p to pause the scroll. Sending it again resumes the scroll.
  • /< to scroll faster
  • /> to scroll slower
  • /+ to increase brightness level
  • /-  to decrease brightness level
  • /e  to erase the display
  • - See more at: http://embedded-lab.com/blog/?p=9255#sthash.yRMeEzfv.dpuf
  • (message) – The scrolling display message must be sent enclosed by parenthesis.
  • /p to pause the scroll. Sending it again resumes the scroll.
  • /< to scroll faster
  • /> to scroll slower
  • /+ to increase brightness level
  • /-  to decrease brightness level
  • /e  to erase the display
  • - See more at: http://embedded-lab.com/blog/?p=9255#sthash.yRMeEzfv.dpuf

    Κυριακή, 26 Απριλίου 2015

    Control Your Appliances via Bluetooth

    This project is the brain of the future house, you can control your home through internet from another place of the world and just an ethernet shield connected to the arduino board, you can control your home through wi-fi with another module, with this circuit I show you, you can control your appliances through bluetooth with your android phone. Based on the project of these Thai guys "http://androidcontrol.blogspot.ie/2014/06/android-bluetooth-control-8-devices.html" and the android app here: " https://play.google.com/store/apps/details?id=com.app.control", now our life can be a lot easier since we can turn on a switch which controls a lamp or the water heater from our bed! The project is based on an arduino, which depending the data it takes from the bluetooth module controls 8 digital pins-outputs which are controlling 8 relays-switches. In my occasion the specs of the relays were : 5V coil, switch 230V. Meaning that the relay could be armed with 5v and can control a load till 230V. The module I got had also 8 LEDs which show when the relay was armed, and also 8 npn transistors and 8 optocouplers which controlled the relay for better protection.

    The schematic is very easy to follow and with the arduino code the Thai guys provided, this project can be made in an evening, now depending on your demands you can use it as you like. The video here is very informative and it shows how the program works, it also has 8 independent timers which can be set for different timings. Every time I pressed an output on my phone, a relay was energized and an Led was light on. If I pressed again the same output the relay was de-energized and the Led was light off. Finally I also provide 2 types of code one with active low, meaning all ouputs are off and when you press your phone they go high, and one code active-high meaning all outputs are high, and when you press your phone they go low, I suggest to use the active-low code.
    Arduino Code : https://www.dropbox.com/sh/ceqntenyh8jbwy4/AABw_n1hyKHJG9HRrZmw4H44a?dl=0

    Κυριακή, 19 Απριλίου 2015

    Repair A Power Supply of A PC

    A few days ago a friend of mine gave me a fault power supply, which he was going to through away. I tooked it from him and I repaired it. In most cases of a pc power supply the problem may be occured due to false capacitors which are the first parts to show some damage in a period of time. One big advantage if a capacitor is false it's that you can see it immediatelly (mostly!) without a special meter, because a blown capacitor looks different from a good capacitor. Precautions must be taken in case a capacitor still is charged because you might have a good zap! Measuring the voltage across their legs and discharching through a 5W - 1KΩ resistor is a good solution. Opening the case I was lucky to find quickly the two bad components. Unfortunatelly I didn't took a picture from them when they were on board but afterwards.

    The capacitors where positioned in the corner left, as you can see from the pictures the difference between 2 fault capacitors and 2 good capacitors are visually easy. Pay attention to capacitance ratings and voltage ratings, The ones you change should be same capacitance and if not same voltage, then bigger. If they are bigger voltage pay attention because the size of capacitors increases too and it will need some extra effort putting it back to the board. Next step is to download a schematic with all the wires and their names (voltages) connected to the 24-pin clip or 20-pin clip. (In my ocassion 24-pin).

    As we can see there is a pin named "PS_ON#"  (in most cases it's green) and this one should be connected to ground if we want to power on our supply without connecting it to a load (e.g. the pc).

    Next step is to measure all the voltages according to the above schematic, so these are the values we should take from every pin. :  +3.3 Volts,   +5 Volts,   +12 Volts,    -12 Volts. Colors of cables should be different but in my occasion 3V3 was orange, 5V was red, +12V was yellow, -12V was blue and Ground was black.

    If all voltage pins are the same with the schematic above, then you are set to go with a new power supply!

    Δευτέρα, 6 Απριλίου 2015

    Arduino Car Controlled by Bluetooth

    In this article you will read about the construction of a car controlled by your android phone. It might sound a bit complicated but the hard part is the android part, thankfully Andi.co with the app "Arduino Bluetooth RC Car" has made out life easier, all we have to do is download the app and connect to the bluetooth module once we have programmed the arduino board, and make our electronic connections. Following the schematic, we'll see that we connect a 9v battery to our motor controller which is a L298N Bridge, basically it gets orders from our arduino and does all the "heavy duty work" since arduino can't provide directly enough power. My L298N board had a voltage regulator, so the Battery clips were connected to the pins "Vin" and "Ground", also I connected my battery to 'Vin" and "Ground" of arduino. In the schematic you will see the rest of the connections of the L298N which afford the connections betweens motors, and the arduino pins. Finally there is the bluetooth module which has 4 connections and they are 5V,Ground, Rx,Tx. As we know from the previous project Rx of Arduino connects to Tx of Bluetooth module and Tx of Arduino connects through a voltage divider to Rx of the Bluetooth Module. We can connect any type of resistors as long we can provide 3.3 volts to our pins. In my example I use 1K and 2K. The rule of the voltage divider is this : Vout = [Rdown / (Rdown + Rup)] x Vin. So : [2K / (2K+1K)] x 5V = 0.6666 x 5V = 3.3 Volts. Lastly one crucial reminding is : DON'T CONNECT THE BLUETOOTH WHEN YOU UPLOAD THE SKETCH TO ARDUINO, or else you will have some conflicts and you will scratch your head for hours!

    Τρίτη, 24 Μαρτίου 2015

    RGB Led Strip Controlled by Bluetooth & IR

    A few months ago I saw GreatScott's project which had an RGB led strip and he could control it through his tv control with an arduino and some more components including one MOSFET. This was an overkill since he had 3 colors and he choose to shortcircuit the legs and get just one color. In my version I use 3 MOSFETS to control each color separate. The whole project is based on Scott's schematic with the difference I use 3 MOSFETS and the resistor that connects arduino to the base of the MOSFET is 1K and not 10K like Scott suggests (it took me 3 days to find this problem)! Also I made some changes to the code since we have to do with 3 colors and not just one. When I finished building it another idea came to me, why not control it with my android phone also? Fortunatelly some people from Thailand which I don't know their names because it was in Thai were tenderhearted and offered the arduino code and android app for free. One positive point was that minor changes had to be done to the hardware part. A bluetooth module and connections to Vss,Gnd, Rx and Tx. Again I Had some problems in the code because there was a conflict between the bluetooth and the IR part but after some trial and error, everything worked perfectly. One crucial thing to do in the IR part is that because every controller-tv has a unique code depending on the manufacturer is to get the IR codes for the controller of the led strip by running the arduino example "IRRecvDemo". There by running the serial monitor and pressing the keys you want for control you should get 7 different codes (Red Up/Down, Green Up/Down, Blue Up/Down And Power On/Off-Same key), then you must replace these codes in the arduino code and everything should work fine. Finally as you will see in the schematic my bluetooth's Rx pin has a voltage divider which is 3.3 Volts and it works fine, manufacturer suggests this voltage cause arduino's 5V might burn it.

    I provide the schematic and the arduino code for The IR controller separately if you want to build it individually. And also the schematic and the arduino code if you want to build the mixed version!
    You can estimate for every meter you will need 1A power supply, so for a 5m RGB strip you will need a 12V / 5A Power Supply.

    Android app : https://play.google.com/store/apps/details?id=arduino.control.rgbleds
    Arduino code : https://www.dropbox.com/sh/g3yns970ma15up1/AAAswMf26Ml1UC3xgPBR8D0sa?dl=0