Optoelectronics (e.g., light-emitting diodes, photodetectors) is one of the most widely used fields nowadays. But it is still necessary to improve their characteristics for using in general lighting. In this chapter, the heterostructure conductivity type, impurity and indium atoms influence on the LEDs and phototransistor characteristics are investigated by computer simulation. It was found that current-voltage characteristic and quantum efficiency depend on impurity and indium atoms change a lot. By varying impurity and indium atom concentration, controlling their distribution in InGaN and AlGaP heterostructure LEDs and photodetector characteristics can be improved.