githubdoe / skysolve

Use RaspberryPi and plate solving to take images of the night sky and identify the location of the image.
GNU General Public License v3.0
32 stars 8 forks source link

Using skysolve with Raspberry Pi CM4 compute module #7

Open Polar-Axis opened 3 weeks ago

Polar-Axis commented 3 weeks ago

Thanks for creating this repository, the code works very well.

I wanted a compact camera to fit on a DLSR hotshoe mount so I went for a CM4 compute module as they are tiny and most of the RPi connectors are not needed:

20240710_142612

In the end I used an IMX296 mono camera with a 25mm M12 lens and created a 3D printed case and fitted a slim heatsink to the CM4. This makes a small and light camera:

20240715_144143~3

Initially the code failed to run. This was found to be an incompatibility with the RPi 4 and CM4 GPIO commands in skysolve.py circa line 40:

RPi 4 line: GPIO.setmode(GPIO.BOARD)

Change for CM4 bard: GPIO.setmode(GPIO.BCM)

Note that GPIO are not easily accessible on the CM4 but it is possible to use GPIO40 (nRPIBOOT) as that is usually available as a button on CM4 interface adapter boards.

Also I see that gpio7 is defined multiple times in the skysolve.py, so any change to the GPIO pin needs code changes in a number of places in the code.

The M12 lens is small but f0.95 (I think) and I find that 0.7s exposures work well, with position solve updates every 2-3 secs.

Polar-Axis commented 3 weeks ago

I have looked into this problem further.

BOARD is for the physical pin numbers on the RPi P1 connector. The CM4 does not have such a connector so there is no mapping of the allocated physical pin numbers to the Broadcom SOC gpio channel designation. Thus it is necessary to use BCM and the chip level channel gpio designation.

It should be possible to detect the RPi board type to choose the appropriate command line, but that is not needed for the recommended hardware build.