The present invention provides a device for automatic detection of battery polarity, wherein a detector circuit is structured from detector terminals, detector units, positive voltage electrical connecting units and negative voltage electrical connecting units. Specifically, the invention relates to the use of Graph Embedding as a method of reducing dimensionality thereby improving supervised classification of classes, both conventional and new ones. The spring also comprises a spring stiffness variation systems which produce different stiffnesses depending on whether the spring is compressed or slackened.