A traditional wireless sensor network is composed of several sensors and a sink. The sink analyzes data measured by the distributed sensors and takes appropriate action. A problem with this kind of architecture is that it may have a single-point of failure. Also, sensors are not connected directly to the sink and must send data by hopping through other sensors. This means that it would take more time for the sink to collect data. In a wireless sensor network, noise may distort the message during transmission. An intruder may also alter the message maliciously. So far, there has been little research done on the design of robust wireless sensor networks to overcome the single-point of failure problem and environmental interference. In this study, we propose a consensus problem algorithm based solution to enhance the accuracy of the detected result in an autonomous local sensor network without a centralized sink. Under our scheme, there is no need to send the detected value to the sink. The solution can therefore reduce the transmission and routing time, allowing appropriate action to be made directly and quickly.