Arduino Ethernet Camera

Posted by Techno On mardi 2 mai 2017 1 commentaires





I will introduce a Arduino ethernet Camera.
You can take a picture inside of house which have a this arduino ethernet camera by just openning the web site if you follow this contents.
It is very easy and simple way which don't need any app. for smart phone.
Let's start.

Step 1: Prepare Meterials







We need a several meterials.
1. Arduino Uno 
2. Arduino Ethernet Shield
They are all.... for this project.

Step 2: Hardware Connection


Hardware connection is very easy.
Just follow picture.
Picture shows us all of we have to connect.

Step 3: Prepare for Software : Library

We need download few libraries for this project
You can download libraries in http://arduino.cc
Adafruit_VC0706.h (for TTL Camera)
SdFat.h (for SD card)
SdFatUtil.h (for SD card
Ethernet.h (for Ethernet shield , default installed in Sketch)
SoftwareSerial.h(for TTL Camera)
If you downloaded them, you are ready for run this project.


Step 4: Software : Sketch Code



Here is a sketch code we need to run this project.
Please download attached sketch file (ethernet_camera.ino)
There are little to know about this code.
1. You have to modify mac[] and ip[] as your arduino's information.
2. To see jpg file on browser, we have to give a command to translate to jpg format as below four line.
client.println("HTTP/1.1 200OK");
client.println("Content-Type: image/jpeg");
client.println();
client.print((char)c);

Step 5: How to Run & Test Result




1. To take a picture
Just type http:/xxx.xxx.xxx.xxx:5555/ttt on any internet browser.
2. To See a taken picture
Just type http:/xxx.xxx.xxx.xxx:5555/image.jpg on any internet browser.
3. To remove a tacke picture
Just type http:/xxx.xxx.xxx.xxx:5555/rrr on any internet browser.
The Picture shows the result of test.
Thank you and enjoy it.
















READ MORE

Simple 'Hello World' On a LCD Display with nano Arduino

Posted by IEE Engineer On mardi 14 février 2017 0 commentaires



This project is for beginners who just bought a 16x2 LCD display.
if you want to make a simple and small project of this LCD,then...
"HELLO WORLD" Is perfect for you!
see the schematic and build the circuit then copy paste the program on your Arduino IDE software
And then you have a simple LCD display circuit,displaying "HELLO WORLD!"

Step 1: Order your components:





the components required for this build are:
1xLCD Display(16x2)
1x220 ohm resistor
1xArduino Nano
1xBreadboard
1x10K Potentiometer
some jumper wires or single strand wires.
You can buy all your components from Amazon.com.







Build this small schematic...
the connections:
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
then wire a 10k pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3). A 220 ohm resistor is used to power the backlight of the display, usually on pin 15 and 16 of the LCD connector.

Step 3: The code:

The code:
#include <LiquidCrystal.h>//Don't forget to enter this library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("HELLO WORLD!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis() / 1000);
}

Step 4: SUCCESS!















READ MORE

PIC18 Development Board with Ethernet and USB

Posted by Techno On samedi 11 février 2017 2 commentaires



In this project I'm going to show you how to make your own PIC18 development board that features both Ethernet and Full Speed USB 2.0 at a low cost.
Features:
The development board is based on a PIC18LF4553 microcontroller. The microcontroller features a Full Speed USB 2.0 (12Mbit/s) interface without the need for any external components. Also, it has 32KB of program memory, 2KB of RAM and it supports an external clock up to 48MHz, which is optional because it also has an 8MHz internal clock.
The ENC28J60 Ethernet controller is used to provide Ethernet connectivity to the microcontroller thought the SPI interface. The ENC28J60 has an integrated MAC and a 10Base-T PHY, 8KB of buffer RAM, supports both Full and Half-Duplex modes and it is fully compatible with 10/100/1000Base-T networks.
The microcontroller is not soldered directly on the PCB but mounted on an IC socket. The advantage of doing this is that when you are done with the development of the code and you want to make a prototype, you can just pop the microcontroller out and make a new PCB with only the components you actually need for your project.
Because the ENC28J60 needs a 3.3V supply to function I decided to power the microcontroller from 3.3V too. That eliminates the need for two different voltage regulators and for logic shifters between the microcontroller and the Ethernet controller. That means reduction of the BOM cost and more space available on the PCB for other components. On the other hand the LF version of a PIC microcontroller can function over an extended VDD range of 2.0V to 5.5V, so if your project needs to run on 5V instead of 3.3V when you move the microcontroller from the development board to a more permanent board you can power it from 5V if you want.
The board can be powered either from the USB port or from an external source from 4.5V up to 12V though the power jack. Keep in mind though that the ENC28J60 can draw up to 180mA so if you try to power the board from a standard 9V battery you may have problems. The selection of the voltage source is done by a jumper.

Step 1: The Parts











To make the development board you will need the following parts:
  • 10 x 100nF Ceramic SMD Capacitors (0603 package)
  • 2 x 10uF Tantalum SMD Capacitors (3528 package)
  • 4 x 22pF Ceramic SMD Capacitors (0805 package)
  • 1 x PIC18LF4553 or PIC18LF4550 (PDIP package) - I recommend using a PIC18LF4553 because it has a 12 bit ADC (which is basically the only difference between the two). The PIC18LF445x microcontrollers are also compatible with the board but they have 24KB of program memory instead of 32KB.
  • 1 x 40 pin PDIP IC Socket
  • 1 x ENC28J60 (SPDIP package)
  • 1 x MagJack RJ45 Connector - The particular I used is this and its part number is MJF13T3L-KF06B3YG-0808. If you are going to use a different one make sure to check the datasheet first, because you may need to modify the design files in that case. For example, I was able to find some HR911105A ones from eBay for very cheap, but unfortunately if you check the of HR911105A datasheet it doesn't 't have the same pinout. Sure, it will work but you will have to modify the board layout.
  • 1 x DC Barrel Jack 5.5mm (Through hole)
  • 1 x USB Mini-B SMD Connector
  • 1 x 25MHz XTAL SMD (HC49/UP package)
  • 1 x 8MHz XTAL SMD (HC49/UP package) - I used an 8MHz XTAL but any XTAL up to 48MHz will work.
  • 2 x 10K SMD Resistors (0805 package)
  • 8 x 100Ω SMD Resistors (0805 package) - 1% tolerance if possible.
  • 1 x 1.5K SMD Resistor (0805 package)
  • 1 x 2.2K SMD Resistor (0805 package) - 1% tolerance if possible.
  • 1 x 120Ω SMD Resistor (0805 package) - 1% tolerance if possible.
  • 2 x 470Ω SMD Resistors (0805 package)
  • 1 x Momentary SMD Switch - The particular I used is this, but you can use any momentary switch you want with the same footprint.
  • 1 x Ferrite Bead rated for at least 80mA (Through hole) - If you can't find one you can make one yourself using a small toroid ferrite core and a little solid core wire (like I did). Five to six turns is all you need.
  • 1 x LD1117V33 SMD Voltage Regulator, also known as LD33 (SOT223 package)
  • 1 x 2.54mm (100mil) 40-pin Male Pin Header (Through hole) - You will need to cut it to smaller pieces.
  • 1 x 2.54mm (100mil) 4x2-pin Male Pin Header (Through hole)
  • 1 x 2.54mm (100mil) 40-pin Female Pin Header (Through hole) - You will need to cut it to smaller pieces.
  • Solid core wire to use it for the jumpers on the PCB - To fit the holes on the PCB the copper inside the wire needs to be around 0.65mm (22 AWG). A slight thicker solid core wire should also work.
  • 1 x 80x62mm PCB - Photoresist or bare copper depending on the etching method you are going to use.
  • 1 x 2.54mm (100mil) jumper - The same like the ones that are used on computer motherboards.
Optional Parts:
  • 4 x Female to Female Brass Standoff Spacers
  • 4 x Screws for the Spacers
The BOM cost will be around 13€ to 15€ ($14.8 to $17) depending from where you'll buy the parts. Most of the parts can be found easily on eBay.

Step 2: Making the PCB




The next step is to make the PCB. Because this is not a tutorial about PCB etching I'm not going to get into details about the process, but instead I'm going to give you some guidelines specific to this project.
[ Credits to Chris Meletis for the PCB layout ]
Etching the PCB:
Before you choose the etching method you want to follow keep in mind that some traces have a clearance of 0.3mm
(12mil) so if you try use the toner transfer method you might experience some issues. I don't say it's not possible but it will definitely be more difficult than the photoresist method to get a good result. Personally, I used the photoresist method and the result was great on the first try. I only had a minor issue with one of the traces, but that was caused by a clearance error on the layout not by the etching process itself. Now the layout has been corrected so you won't have any issues.
If you choose the photoresist method, about the exposure make sure to use only one high resolution transparency otherwise you might fail to expose correctly the traces that have very small clearance and/or the thermal pads. I had great success using a good inkjet printer and high resolution inkjet transparencies. The transparencies were a little expensive but worth every cent.
About the development of the PCB, the trick to know when you are done is to wait for the thermal pads to show up. When you are able to see the thermal pads then you know that the board is ready for etching.
Drilling the Holes:
After you etch the PCB you will have to drill the holes for the through hole components. Most of the holes need either a 0.8mm or a 1mm drill bit. The holes for the ICs and the ferrite bead are 0.8mm. The holes for the pin headers and the jumper wires are 1mm. The MagJack connector has 2 holes that are 1.6mm for the shield ground and 2 for the plastics that are 3.2mm, the rest are 1mm. The barrel jack needs 3 holes with a diameter of 3.2mm. The Mini-B USB connector needs two 0.9mm holes, that don't have to go all the way though the PCB but only half way. If you don't have a 0.9mm drill bit then an 1mm bit will work fine. Finally, the board also has 4 mounting holes 3.2mm each on the edges that is up to you if you want to drill them.
Update January 2017:
A new revision of the development board is now available, which especially if you plan to get your board fabricated from a professional PCB manufacture you should make sure to use instead. The Gerber files are also available, so if you don’t plat making any changes to the design you can just send them as they are to your favorite PCB manufacturer and get your hands into some professional made PCBs with almost no effort.
If you plan to make the PCB yourself as described in this instructable I still recommend using the old design, because the new one has reduced trace widths and clearances which make home etching much harder.
The old schematic also has a minor mistake, the VCAP capacitor (C3) has been placed backwards. This is not a problem though if you plan to solder the PCB yourself, you just have to be aware of it so you will put it properly while soldering.
         ether_dev_brd
         ether_dev_brd.pdf

Step 3: Soldering the Components








     After drilling the holes it's time for the fun part, to solder the components on the PCB. Most of the components are SMD so you gonna need a little bit of flux to assist you and of course a pair of tweezers. Start by soldering all the 100nF capacitors first since they are the smallest of all the components. After the 0603 capacitors, go for all the 0805 components and after that for the two 3528 tantalum capacitors. Finally, solder the crystals, the USB port and the momentary switch and you are done with the SMD components.
When you are finished soldering the SMD components it's time for the through hole. Note that all the through hole components are mirrored on the PCB layout so they need to be soldered on the non copper side of the PCB. Also, note that there are two jumpers under the microcontroller. You will need to solder them first before you solder the IC socket.
Before soldering the MagJack connector you will have first to cut the pins 4, 5 and 6 because since they are not used they were omitted on the board layout in favor of some extra space for the traces.
Furthermore, because the ENC28J60 unlike the microcontroller needs to dissipate a fair amount of heat, it needs to be soldered directly on the PCB without a socket. That way the copper of the ground plane will act as a heat sink and will dissipate an amount of heat. Another reason you want to solder the ENC28J60 directly on the PCB is to minimize the parasitic capacitance and inductance which can introduce noise.
Finally, on the trace that is connected with the top pad of the voltage regulator make sure to add a fair amount of solder. This is going to help a lot with the heat dissipation of the regulator.
When you are done with the soldering don't forget to clean the PCB from the flux residue. If you use rosin flux then isopropyl alcohol is all you need.
The last thing you need to do after soldering is to put the jumper on the pin header that selects the voltage source.

Step 4: Testing


Now that your development board is finished you need to test it to see if everything is OK. Before you insert the microcontroller to the socket power the PCB and test the voltages on the VDD, VSS and Reset pins of both ICs. You should measure about 3.3V on the VDD and Reset pins referenced to any of the VSS pins.
If the voltages are fine then while the board is still powered plug it to a switch or router and watch the LEDs of the MagJack. If the status LED (yellow in my case) lights up and stays on that means a connection at the physical layer between the two devices is established.
If all the tests are passed then you are ready to insert a microcontroller to the IC socket and program it through the ICSP header. Or if you don't have an ICSP programmer, program it first and then insert it to the socket.


Step 5: Start Coding





The last step is to actually start working with your development board. Depending on the compiler you use this is going to be very different.
Personally, I prefer to work with Microchip's MPLAB X IDE and the XC8 compiler. If that is also the case for you, Michael P. from Microchip's forums has already done a great job writing a small but functional web server with support also for ICMP and Telnet protocols for PIC16F/18F microcontrollers.
Based on his work I made some small modifications to the code to make it run on my development board. Basically, the only thing I did is that I added support for the PIC18LF4553 microcontroller, and I also moved the CS pin from RC2 to RC6 because that is the one I use on my development board. By having this project as a starting point you can study it and expand it by adding more functionality.
To get started, first download the attached zip file, extract it inside your MPLAB X project folder and open it using the MPLAB X IDE. To test the code the only thing you have to do before compiling and uploading it to the microcontroller is to change the default IP (inside main.c at line 17) in order to be in your own network. For example the IP of my desktop computer is 192.168.2.180 with the subnet mask 255.255.255.0. That means my desktop is in the network 192.168.2.0/24 or in other words a valid IP address for a device in my network is every IP between 192.168.2.1 and 192.168.2.254. So, I gave it the IP 192.168.2.111 which belongs to the 192.168.2.0/24 network and is not already occupied by another device on my network.
After compiling and uploading the code to the microcontroller you should be able to see the default web page of the microcontroller by typing its IP to the address bar of your web browser. Furthermore, you should be able to ping the device and access it via Telnet.
If the compiler of your choice is not XC8 but Mikroelektronika's MikroC for example, unfortunately I can't help you much since I have very little experience with MikroC. The only think I know for sure is that MikroC has an Ethernet library that supports the ENC28J60 but apart from that I can't help you any further.
Beyond Ethernet:
As you may noticed I spent the largest part of this step talking about how to get started with Ethernet. The reason I did that is because many people find it more complicated than other subjects and don't know were to start.
But the fact that the development board features Ethernet connectivity does not mean that you have to use it on every project. The board can be used as a general purpose development board for any project you are working on. The only thing you have to remember is to keep the CS pin high (RC6) in order be able to use the SPI bus with other devices than the ENC28J60.

    encnet.X.zip

READ MORE

Serial to Ethernet Converter

Posted by Techno On 0 commentaires


Devices like a serial printer, barcode scanners, scale, GPS, surveillance cameras, serial consumer/ industrial devices all have one thing in common and that is they all use RS232, RS485 or RS422 serial cable connection to interact with a computer. Having remote access to this kind of devices from a remote computer is a headache that I plan to show you how you can get rid of.
To access these devices via Ethernet or LAN or convert Serial Port to IP, we can use two solutions viz: Serial to Ethernet Converter (Software) and any Hardware with COM port to Ethernet converting capability.
Let's start with the software solution, as I already mentioned it is called Serial to Ethernet Converter and was developed by Eltima.

Serial Port to Ethernet converter (Software)



Description of Serial to Ethernet converter: Serial to Ethernet Converter facilitates access to any serial port device connected to a local computer/device from any remote location and the remote computer will treat this device as if it was physically connected to its serial port. Here there is no need for installation of additional software. You can share more than 500 serial port devices over TCP/IP network without any restriction. These created ports can also be accessed simultaneously.
How to use Serial to Ethernet converter: You start with the installation of the software on all the computers that will use the serial device. By doing this, the serial device will be made available over the Ethernet to you and every other person who is going to use the serial device.
Serial to Ethernet Converter enables conversion of COM port data to Ethernet. These converted data can in turn be shared and accessed over network. Here the remote computer will display a virtual serial connection that helps the software communicate with the port.
A noteworthy feature of Serial to network converter is that it runs as a Windows service. This guarantees that every single connection is automatically reconfigured on system reboot. This is a feature I found interesting because you don’t need to keep the interface constantly open, it will be running in the background. The other fantastic thing about Serial to Ethernet Converter is the ability to transfer a configuration to another computer in form of backup.
It is available for Windows and Linux platform. It is also interesting that you have the flexibility to decide which platform will be the server and which will be the client. However, the Linux version available now is a command-line solution. It can as well broadcast over UDP too.

Hardware Solutions that can convert serial port to Ethernet:


Description: This is a small electronic device capable of converting either RS232, RS485 or RS422 serial data signals to Ethernet IP/TCP packets and vice versa. In other words serial to Network converter. The downsides of this type of devices include available port limitation. It can be 1 or 20 ports for instance and you can’t alter the numbers because they are fixed. Serial to Ethernet Converter is fairly easy to use and set up, although it’s an edge to have an idea of the computers and network settings.
How it works: All converters have an inbuilt circuitry capable of converting serial data to IP/TCP packets and back. It can convert to any direction.
Setup guide: The hardware comes with a driver (alias virtual COM software) that needs to be installed first into your computer. Once the installation is complete, the virtual COM software will now be able to create a virtual COM port in your computer's Device Manager when the hardware is connected to your computer.
At this point, you can now connect the hardware to your computer using the standard cable which is normally included in the hardware box. Next step is to connect your converter to a power supply, enter the IP of the hardware into your browser address bar and click enter. Now you can set up the converter by assigning a static IP to your own computer. This is important for communication between your computer and the converter. Now you are good to go.
I hope this article will help you choose the best solution for your usage Scenario.



READ MORE

LR Series Circuit

Posted by Techno On mardi 11 novembre 2014 1 commentaires
In our first tutorial about Inductors, we looked briefly at the time constant of an inductor stating that the current flowing through an inductor could not change instantaneously, but would increase at a constant rate determined by the self-induced emf in the inductor.
In other words, an Inductor in an electrical circuit opposes the flow of current, (  i  ) through it. While this is perfectly correct, we made the assumption in the tutorial that it was an ideal inductor which had no resistance or capacitance associated with its coil windings.
However, in the real world “ALL” coils whether they are chokes, solenoids, relays or any wound component will always have a certain amount of resistance no matter how small associated with the coils turns of wire being used to make it as the copper wire will have a resistive value.
Then for real world purposes we can consider our simple coil as being an “Inductance”, L in series with a “Resistance”, R. In other words forming an LR Series Circuit.
LR Series Circuit consists basically of an inductor of inductance L connected in series with a resistor of resistance R. The resistance R is the DC resistive value of the wire turns or loops that goes into making up the inductors coil. Consider the LR series circuit below.

The LR Series Circuit

lr series circuit
The above LR series circuit is connected across a constant voltage source, (the battery) and a switch. Assume that the switch, S is open until it is closed at a time t = 0, and then remains permanently closed producing a “step response” type voltage input. The current, i begins to flow through the circuit but does not rise rapidly to its maximum value of Imax as determined by the ratio of V / R (Ohms Law).
This limiting factor is due to the presence of the self induced emf within the inductor as a result of the growth of magnetic flux, (Lenz’s Law). After a time the voltage source neutralizes the effect of the self induced emf, the current flow becomes constant and the induced current and field are reduced to zero.
We can use Kirchoffs Voltage Law, (KVL) to define the individual voltage drops that exist around the circuit and then hopefully use it to give us an expression for the flow of current.
Kirchoff’s voltage law (KVL) gives us:
kirchoffs voltage law
The voltage drop across the resistor, R is IR (Ohms Law).
voltage drop across a resistor
The voltage drop across the inductor, L is by now our familiar expression L = di/dt
voltage drop across an inductor
Then the final expression for the individual voltage drops around the LR series circuit can be given as:
lr series circuit voltage
We can see that the voltage drop across the resistor depends upon the current, i, while the voltage drop across the inductor depends upon the rate of change of the current, di/dt. When the current is equal to zero, ( i = 0 ) at time t = 0 the above expression, which is also a first order differential equation, can be rewritten to give the value of the current at any instant of time as:

Expression for the Current in an LR Series Circuit

current through lr series circuit
  • Where:
  •     V is in Volts
  •     R is in Ohms
  •     L is in Henries
  •     t is in Seconds
  •     e is the base of the Natural Logarithm = 2.71828
The R/L term in the above equation is known commonly as the Time Constant, ( τ ) of the LR series circuit and V/R also represents the final steady state current value in the circuit. Once the current reaches this maximum steady state value at , the inductance of the coil has reduced to zero acting more like a short circuit and effectively removing it from the circuit.
Therefore the current flowing through the coil is limited only by the resistive element in Ohms of the coils windings. A graphical representation of the current growth representing the voltage/time characteristics of the circuit can be presented as.

Transient Curves for an LR Series Circuit

lr transient curves
Since the voltage drop across the resistor, VR is equal to IxR (Ohms Law), it will have the same exponential growth and shape as the current. However, the voltage drop across the inductor, VL will have a value equal to:  Ve(-Rt/L). Then the voltage across the inductor, VL will have an initial value equal to the battery voltage at time t = 0 or when the switch is first closed and then decays exponentially to zero as represented in the above curves.
The time required for the current flowing in the LR series circuit to reach its maximum steady state value is equivalent to about 5 time constants or 5τ. This time constant τ, is measured by τ = L/R, in seconds, were R is the value of the resistor in ohms and L is the value of the inductor in Henries. This then forms the basis of an RL charging circuit were 5τ can also be thought of as “5 x L/R” or thetransient time of the circuit.
The transient time of any inductive circuit is determined by the relationship between the inductance and the resistance. For example, for a fixed value resistance the larger the inductance the slower will be the transient time and therefore a longer time constant for the LR series circuit. Likewise, for a fixed value inductance the smaller the resistance value the longer the transient time.
However, for a fixed value inductance, by increasing the resistance value the transient time and therefore the time constant of the circuit becomes shorter. This is because as the resistance increases the circuit becomes more and more resistive as the value of the inductance becomes negligible compared to the resistance. If the value of the resistance is increased sufficiently large compared to the inductance the transient time would effectively be reduced to almost zero.

LR Series Circuit Example No1

A coil which has an inductance of 40mH and a resistance of 2Ωs is connected together to form a LR series circuit. If they are connected to a 20V DC supply.
a). What will be the final steady state value of the current.
lr series circuit steady state current
b) What will be the time constant of the RL series circuit.
time constant of lr series circuit
c) What will be the transient time of the RL series circuit.
transient time of lr series circuit
c) What will be the value of the induced emf after 10mS.
induced emf
d) What will be the value of the circuit current one time constant after the switch is closed.
instantaneous current
The Time Constant, τ of the circuit was calculated in question b) as being 20mS. Then the circuit current at this time is given as:
instantaneous current value
You may have noticed that the answer for question (d) which gives a value of 6.32 Amps at one time constant, is equal to 63.2% of the final steady state current value of 10 Amps we calculated in question (a). This value of 63.2% or 0.632 x IMAX also corresponds with the transient curves shown above.

Power in a LR Series Circuit

Then from above, the power in a LR series circuit is given as:
The instantaneous rate at which the voltage source delivers power to the circuit is given as:
instantaneous power
The instantaneous rate at which power is dissipated by the resistor in the form of heat is given as:
power in resistor
The rate at which energy is stored in the inductor in the form of magnetic potential energy is given as:
power in inductor
Then we can find the total power in a RL series circuit by multiplying by i and is therefore:
instantaneous power in a lr series circuit
Where the first I2R term represents the power dissipated by the resistor in heat, and the second term represents the power absorbed by the inductor, its magnetic energy.
READ MORE