Fun with Python and Raspberry Pi

Morrell Group prioritizes learning new programming languages so we can provide the best level of support to our customers. Gaining a well-rounded knowledge of programming languages also helps us with newer product launches coming from our vendors, like Bosch Rexroth’s ctrlX platform. Recently, Dan Wilson, a Sales Engineer at Morrell Group, spent three months learning the basics of Python and applying his knowledge to develop a functioning example.

Dan’s fun with Python started in July when he was tasked with learning Python and programming an automated function. He purchased a Raspberry Pi, a versatile mini-computer, and an R&D tutorial kit to aid his learning process. The R&D tutorial kit includes several different projects and code examples from tasks as simple to turning on an LED light to making a motor run.

He spent the first month learning Python by taking classes through the Code Academy. The following month he worked through the tutorials included in the R&D kit and in the final month, he developed his own automated program. Dan’s program, developed in Python, can simultaneously and independently control the speed and direction of two DC motors. His program used potentiometers, which can be used to simulate an analog signal from a proximity sensor, to control the signal going to the motor to regulate its speed and direction.

Developing the code was not without its issues. Since this Raspberry Pi only accepts digital and the potentiometer only outputs analog, Dan’s program required an analog to digital converter chip with 8 channels. Initially, the converter chip was trying to read two signals at the same time, which caused an error in the program to make it stop running. Dan discovered if he changed one line of code telling the program to pause for 0.2 seconds before reading the next channel of the converter chip, the problem was solved.

Now, Dan plans to continue learning Python, and other higher-level programming languages, and he will gain more experience with Bosch Rexroth’s ctrlX platform upon its release.

Request more info today!

Please fill out the form, give us a call or send us an e-mail. We can't wait to hear from you!

248-373-1600