I am currently working on customizing the flashing frequency of a torch light (customized intervals between on&off). To program the individual frequency I have made use of an attiny 85 microcontroller that I have programmed with the help of an arduino. On a breadboard my experiment worked well. I have attached the pins of the attiny 85 as follows:enter image description here

Pin8: Long lead LED & + side of the battery; Pin5: Small lead LED; Pin 4: - side of the battery; To realize this experiment for a torch light I have disassembled a torch light and replaced the board (see figure) enter image description here with a self-made one making use of a perfboard (see figure) enter image description here.

Well if I attached the red wire (of an external battery box) to pin 8 and the black wire (of an external battery box) to pin 4 of the attiny85 the torch works well. However I wanted to replace the board and it should work the way it worked before with the programmed mode making use of the battery of the torch light as power source.

The battery within the torch light is placed on the back side. There only the plus side of the battery touches the spring and this gets again in touch with the self made perfboard. Here I am aware that the energy wlil flow through the spring to the soldered microcontrller. Hence alle soldered and connected pins of the attiny 85 will have the voltage of the battery. However I cannot determine certain pins to be charged and some not to be...( here I think I am missing a point) The problem I experience is that only the plus side of the battery, placed in the torch light, gets in touch with the perfboard. The torch light does not work using my perfboard. I know for sure that the torch will work if both the plus and the minus side of the battery are attached to the microcontroller(pin 4/8). However the initial torch light was also attached only to the plus side of the battery, and it did work. I don't know how. This is the cicuit enter image description here I applied on the perfboard. The batteries are not feasible to be connected that way. Therefore the experiement on the bread board worked unlike with the perfboard applying on its torch light. I dont get the minus and plus side of the battery to touch only the respective pins of the attiny.

1.I know I am doing something wrong or thinking little naively, can you give some hints in order to get the torch / flash light to work making use of my customized perfboard?

  1. Do I have to ensure that pin8 and pin4 of the attiny 85 are attached with the respective side of the battery to get my torch/flash light work or is there another way to get the flash light to work?
  • \$\begingroup\$ Flashlights frequently use their metal case as a conductor. \$\endgroup\$ Commented Jun 30, 2015 at 23:28

1 Answer 1


As Ignacio said - the outer case of the torch supplies the -ve connection from the battery. You need to supply a connection for circuit-negative to the case at the edge of the perf board

enter image description here

The current drive capability of an ATtiny85 is not very large and will not drive an LED very brightly. If the result you get is acceptable then move current drive may not be needed. You do not say what battery voltage you are using but if it is say 3 x AAA batteries then adding a current buffer is not hard but can be challenging. Ask about thi if of interest.

All unused I/O pins of the ATtiny85 must be dealt with properly to avoid problems. Either set pins to output, or set them to inputs and connect to ground or Vcc (ideally via a resistor. Any of these option avoid having the pins float in a high impedance state with a possibly unexpected effect on circuit performance.

  • \$\begingroup\$ Thx for your answer! 1. Do I comprehend correctly that the in the initial torch light the metal case conducs the negaive terminal to theouter part of the chip as seen in the picture above? 2. In my case however I have to make sure that the outercase of torch is somwhow connected to pin 4 of the attiny, right? I am planning to use 3,6V (3xAA). \$\endgroup\$
    – Sathees
    Commented Jul 12, 2015 at 10:04
  • 1
    \$\begingroup\$ @Sathees Yes, as shown by red arrows etc. | How you get from the outer to pin 4 is up to you. | You should run the circuit "on the bench" with a power supply and a range of voltage to see what range it works over acceptably. Note that 3 x NimH or NiCd will have about 3 to 3.9V operating range. 3 x Alkaline is about 3 to 4.95V (when very new) \$\endgroup\$
    – Russell McMahon
    Commented Jul 12, 2015 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.