Is it possible to change the UNO bootloader to manage some pins to be allways input only or output only?

Hello everyone,

I´m electronic teacher in a school in Brazil, so we have some issues with our students, because many times they make some mistakes with input pins and output pins. So, for a schoolar purpouse, I´m trying to modify the Arduino UNO bootloader, letting digital inputs 2 to 8 only in input mode and inputs 9 to 13 only output mode, but I don´t know exactly how to do this.

1 - Is it possible?
2 - How can I do it?
3 - Is there another way to force the compiler to understand the pins as input or output only and don´t allow the users to modify it?

Thank you everyone :smiley:

In the bootloader? No, I don't think so.

In the core? Yes. Sort of. You could modify pinMode() to check which pins were allowed to be set to input or output, BUT... anything can be worked around. It's the kind of thing that would be far too easy for even a moderately determined individual to get around.

In the compiler? Way more work I'd think. And still far too easy to work around to justify it.

1 Like

What is the result of such mistakes ?

1 Like
  • The solution to this situation is to always tell the students to use a 220 ohm resistor in series with GPIOs.

  • This is a small enough resistor that it will not affect pin operation when set to input or set to output.

I can use a diode to avoid mistakes but, offering a code protection and forcing the students to use my pin suggestions, is a easy way to avoid output with output connections, for example.

yes, I see :frowning:

Some students did wrong connections as output with output and damage the arduino chip. So I can use a optocoupler or a diode, but in the course we need to learn basics for the students and they don´t know much about electronics. So forcing my students (in the beggining) to use my code suggestions is a better way.

But that´s ok, I´ll think in a better sollution. Thank you all a lot :smiley: best regards

so, if a I made a wrong connection, example: output with output, so is this resistor enough to avoid pin damage by reverse current in output mode?

Sorry, but I don't understand what you are saying. Do you perhaps mean using output pins as inputs ?

If the end of the 220R resistor is connected to GND or to +5V nothing will get damaged.

Devices connected to this point will still work.

It seems to me that wrapping the students in cotton wool isn’t teaching them anything.

In the real world, thing s get broken if you don’t prepare properly.
There are consequences,

This is harsh, but I’m glad you’re not the driver-education teacher.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.