2

Currently I am working on a dual axis sun calibration device. Everything was going well so far but I made a huge mistake.

Here is what I made so far.

I wrote my code in Python 3.8. Libraries I used:

  • Astropy (sun position calculation)
  • RPi.GPIO (GPIO control to control stepper motor drivers) There are two classes. The following is a short description of them.
  • Numpy (store and save sun position arrays)
  • Matplotlib (drawing and saving graphs with time and sun position as data)

First class is responsible for:

  • stepper motor movement
  • stepper motor movement calculations (how many steps to move by X degrees)
  • auto-home on both axes (set position to absolute zero)
  • keeping track of current position of both axes
  • calibrate both axes accordingly to calculated sun position array
  • calibrate automaticly every X minutes (where X is the frequency that can be changed)

Second class:

  • calculates sun position (altitude-azimuth) for entire day and saves data in numpy array
  • drawing and saving graphs using date and sun position as data
  • calculates sun position current time for instantaneous calibration
  • find sunrise, culumination and sunset

Here you can see how the device works so far. It's a timelapse mode to show how both axes move: Dual axis sun calibration device. Time-lapse mode

The mistake I made is that I didn't write my code with networking in mind. What I want to do is a webpage to remote control the device.

Webpage should do the following:

  • display current axes positon (both altitude and azimuth)
  • display current calibration frequency
  • display sun position graph (graph is stored on RPi memory)
  • move both axes to absolute zero
  • change calibration frequency

Now I am stuck. Could you point me in the right direction what should I do next? What libraries or frameworks would you reccomend for such task?

1

Maybe you could use a framework like Flask. With that you can create a webserver with only a few lines of code. And because it is written in python, you can use the classes you created already :)

1
  • I'm checking it out right now. Seems like a good place to start. Thank you! – Sloth McLazy Jan 13 '20 at 17:21

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.