I have a bunch of Atmega16A MCUs laying around so I want to use them with an ESP8266 to relay temperature and such in each room of my home to a server. The thing is, if I need to update the firmware on them, I need to take the device from that room to a different one to update the firmware.

The issue is once i plug in the programmer, it will supply power to the controller and it'll start detecting the temp of the room and tell the server the room it was in is the temp of the room it is currently in. The server doesn't know the difference so it'll skew my results and such.

So is there some way I can detect when the ICSP 6-pin header has the programmers cable connected? Just some simple thing that will tell the controller, "Hey we may not be in the right room, don't tell the server any measurements"

For clarification, the header that I'm going to use is this one:enter image description here

| improve this question | | | | |
  • 2
    \$\begingroup\$ Are there any other spare pins or links you can fit before plugging the programmer which you could read in SW and inhibit transmissions? \$\endgroup\$ – Brian Drummond Jan 15 '16 at 19:57
  • \$\begingroup\$ Oh you mean like install a jumper or something? Yea I guess that would be incredibly easy. I may just do that, but for the sake of figuring the original thought out, would there be some way of doing it by only interacting with the 6 pins on the header to send a signal to a single pin on the controller? \$\endgroup\$ – Funkyguy Jan 15 '16 at 20:00
  • 1
    \$\begingroup\$ That's why it was a comment not an answer. Look for pullups/pulldowns on the ICSP pins, you might get lucky. \$\endgroup\$ – Brian Drummond Jan 15 '16 at 20:03
  • \$\begingroup\$ You should be able to use an EPS8266 alone to read the temperature sensor and send the data. - don't know if this will solve your problem, however. I've seen a scheme that would allow the 8266 program to be updated via WiFi, which would remove the need to move it for updating. \$\endgroup\$ – Peter Bennett Jan 15 '16 at 20:25
  • \$\begingroup\$ @PeterBennett I've seen this as well, unfortunately the ESP8266 modules I have simply don't have the right pins broken out for it \$\endgroup\$ – Funkyguy Jan 15 '16 at 20:27

How about this? When the board is powered from an external source, the D1 will prevent any voltage from appearing on ICSP VCC and R1 will ensure the line ICSP Present reads low.

When you plug in the programmer and it starts supplying power, the MCU will get power through the diode and ICSP Present will read high.

The 1K resistor is there just to limit the current that may flow through the GPIO ESD diodes.


simulate this circuit – Schematic created using CircuitLab


The datasheet states that the voltage on the GPIOs should not exceed VCC by more than 0.5V, so you should to get a Schottky with a Vf < 0.5V at whatever current your board requires.

enter image description here

| improve this answer | | | | |
  • 1
    \$\begingroup\$ Or add a second diode between ICSP_VCC and the ICSP_Present pin; the voltage drop will bring the voltage down to that of VCC, and the diode selection becomes unimportant. \$\endgroup\$ – CharlieHanson Jan 15 '16 at 20:53
  • \$\begingroup\$ @CharlieHanson Not a bad option! \$\endgroup\$ – Armandas Jan 15 '16 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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