The analysis of traffic jams has become an interesting topic for smart cities. This analysis allows to perform studies for the reduction of environmental contamination, fuel consumption and the driving time. In this article, a wireless autonomous system to estimate the vehicle traffic, oriented to be used in the Internet of Things (IoT) applications is presented. In order to perform the estimation of the speed and orientation of the moving vehicles, the optical flow technique is used through the method of Gunnar Farneback, applying segmentation by morphology to avoid false information captured in situations where the optical flow may not detect the movement. To process and monitor the information in real time, the data is sent to the cloud using Flask framework, making it available for multiple users. The system is designed and verified through a Raspberrypi 2 development card, with a wi-fi module compatible with Ad-Hoc networks