2 hardware but only 1 port ethernet

Discussion in 'Embedded Systems and Microcontrollers' started by mdpai, Jan 6, 2010.

  1. mdpai

    Thread Starter New Member

    Jan 5, 2010
    8
    0
    Hi,
    I have a micro-controller that i want it to act like a gate between my network (the server) and my printer. I want to do something like pushing a button than the server is authorized to send the file to the printer. But the problem is I have access to only a single ethernet port. So I'm thinking to buy 2 port ethernet and put them to my microcontroller board, then connect the microcontroller to the network (the server) and connect the printer to the microcontroller. Is this possible? What I should do with the ethernet ports. Do I need to buy something else or I just need to program my microcontroller with a some code.

    P/S : my microcontroller has linux embedded in it. I attached a possible schema that I think I want to achieve.

    thanks a lot to all suggestions and answers
     
  2. ericwertz

    Member

    Aug 26, 2009
    14
    0
    If you're really considering having a physical button to push to accomplish this, why not just unplug the cable to the printer? Or to save energy, turn the printer off?

    Now if you're thinking of switching access to the printer under software control, there might be a command you can send the printer to enable its input queue.

    My point is more that there are probably other solutions to this particular problem, if this is the problem that you're trying to solve.

    Otherwise, if you're just looking for a excuse to build a 2-port HW/SW SPST Ethernet switch, you probably can. The two questions to ask yourself are 1) does my chosen hardware support this? and 2) does my chosen software stack support this? If you're running any form of Linux, the software absolutely can support it. Knowing nothing about your hardware, I can't answer #1.
     
  3. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    You only need 1 Ethernet port for each device, you can just connect them all to a Ethernet hub. Each device on a network will have its own IP address, so you can send data to one device on a certain IP, then that device can send the info/data to another device with a different IP.


    I have done a project using a PIC32MX uc with Microchips ENC28J60 stand alone Ethernet module, I was able to have an embedded server and also run BSD sockets, SNMP agent, and also had it DHCP enabled all from one Ethernet port, the Pic32 receives data from the PC and distributes it to the appropriate device on the network (Network Printers can be accessed using SNMP agents, and also over TCP/IP.). Microchip has File Stacks for all those protocols available on their site.


    My .02
     
  4. mdpai

    Thread Starter New Member

    Jan 5, 2010
    8
    0
    Thanks for the answer. Actually I just want to make my problem easier to understand, that's why I said "with a push of a button".

    I'll explain here what exactly I want to achieve:

    The situation:
    printer A attached to my board A in room A.
    printer B attached to my board B in room B.
    A person in room C want to print a file. He sends the print jobs to a server.

    So what i'm planning is; that person can go to any printer he wants (in room A or B), than he put some passwords (let say my board have keyboard and lcd screen too), than the microcontroller checks with the server if that person have print jobs and send the print jobs to the specific printer.

    I'm still searching for the correct microcontroller because actually I'm confused, if the server sends a file to print to the printer, it has to go through my microcontroller (I think so). So, do I need a big memory for the microcontroller?

    FYI, I have access to just a port to the network for both of my board and printer. So yes maybe I need a 2 port ethernet hub/switch embedded to my board. One port connected to the network, and one port connected to the printer.


    I hope I've made my problem more clearer.

    Thanks for all the help.
     
    Last edited: Jan 6, 2010
Loading...