Wireless sensor networks (WSNs) is an attractive data collection paradigm for indoor and outdoor monitoring environment. In WSN based manufacturing system environment sensor addition, relocation and reorganization are necessary with the addition or modification of production lines. This sensor addition or relocation sometime increases the sensor density in some areas of the network. In high sensor density area new sensors cannot connect the network due to the capacity constraints of the network. For the environment this paper proposes a two layers autonomous decentralized heterogeneous wireless sensor network architecture. The first layer consists of sensors and the second layer consists of routers. Each sensor is connected with a router and each router is connected with sensors and routers. This paper proposes a technology to make a group of local routers (which is called as community) for switching connected sensors by the routers of the high density areas of the network. A router of a high sensor density area initiates the community construction for switching a connected sensor to another router in the community, if new sensor wants to join the router. The switching is possible if the connected sensor is under the communication range of the other router of low density area. Sometime the community is necessary to expand or shrink based on situation. This paper introduces the community technology to achieve online expansion of the network. The simulation results show the effectiveness of the proposed technology.