This document presents a method for using an artificial neural network to control a DSTATCOM (Distribution Static Compensator) to improve power quality in a distribution system. A DSTATCOM is connected to the distribution system and used to compensate for power quality issues like voltage variations caused by nonlinear loads. An instantaneous symmetrical component theory is used to generate reference supply currents. Terminal voltages are compared to a reference to produce an error signal that is fed into an artificial neural network. The neural network output controls the DSTATCOM to inject compensating currents and regulate the voltage at the point of common coupling, improving power quality. Simulation results demonstrate the DSTATCOM is able to maintain sinusoidal voltages during load changes that previously caused undervoltage issues