JeremyLaurenson / octoprint-emc2101

9 stars 2 forks source link

Does not work #8

Open FAeberh opened 1 year ago

FAeberh commented 1 year ago

I simply don't get this to work. I am not proficient in IT stuff, so please help me out in getting this to work. I wired everything as shown, I checked an rechecked the solder joints and connections. The green light on the EMC 2101 is lit up, the fan is spinning. However there is no readout in Octopi neither for fan speed nor temperature. It simply does not recognise the EMC2101 I think. I did make sure I2C is enabled. Is there anything else I should try? Please bear with me on this one and I apologise if my query is too stupid..... Thanks for your help!!

etellier commented 1 year ago

First, test I2C :

If you use Rpi 4, there are 2 I2C : I2C0 et I2C1 par pins : https://forums.raspberrypi.com/viewtopic.php?t=295172

Check if you use I2C1 pins (3&5) manual : Open a putty session install i2c-tools : sudo apt-get install i2c-tools run i2cdetect : i2cdetect -y 1 (-y = you don't need to use sudo, 1 for I2C1 pins) check I2C address : 4c (default address) If nothing appears, check I2C is enabled (raspi-config), then "double" check wires : pin3 SDA to SDA and pin5 SCL to SCL (I've lost time with that ;-) it's not like Tx-Rx SPI wires)

By Octoprint : You can install GPIO-Status in plugin to show you this in octoprint and which pins to use : image image image Reference for I2C scan : https://learn.adafruit.com/scanning-i2c-addresses/raspberry-pi

I hope it will help you.

wstan6 commented 8 months ago

I'm trying to get this working too. Checked all the above. I2C enabled, wiring correct, I get the EMC2101 on the default address 4c. Still just get the default page in octoprint.

Also not sure if related, I have DS18B20 connected to GPIO 4 was working but only showing 0's now.

Screenshot 2024-02-17 at 14 41 12 Screenshot 2024-02-17 at 14 40 59 Screenshot 2024-02-17 at 14 40 37

Screenshot 2024-02-17 at 14 43 21

wstan6 commented 8 months ago

I'm trying to get this working too. Checked all the above. I2C enabled, wiring correct, I get the EMC2101 on the default address 4c. Still just get the default page in octoprint.

Also not sure if related, I have DS18B20 connected to GPIO 4 was working but only showing 0's now.

Screenshot 2024-02-17 at 14 41 12 Screenshot 2024-02-17 at 14 40 59 Screenshot 2024-02-17 at 14 40 37

Screenshot 2024-02-17 at 14 43 21

I went through the log and found that its detecting the sensor but it is failing to execute a python subscript? Screenshot 2024-02-17 at 19 36 37

JeremyLaurenson commented 8 months ago

Hey folks, sorry I haven't been on top of this - I have since moved on to other things and have a printer that managed all of this internally. The script pulls data from the output of a python script that is run at each check. That script should be returning a nicely formatted temperature | speed value. The script is called with a channel number and whether the sensor used should be the internal one in the chip or an externally wired sensor.

A great way to troubleshoot this is to just run the script: python3 /home/wilson/oprint/lib/python3.9/site-packages/octoprint_emc2101/EMC2101.py 0 0

First 0 is chance, second 0 is "use the chip sensor"

wstan6 commented 8 months ago

Hey Jeremy, thanks for spending some time on this. I'm keen to get this working as the other plugins for Temp/Fan control don't seem anywhere as good.

I did a little test script to make sure the EMC2101 was working. It seems to be ok, the RPM feedback is off but the fan functions as it should. First is with 12V fan GND connected to the EMC2101 GND, second without.

Screenshot 2024-02-18 at 08 42 40

I tired your suggestion and got this. I'm not using a TCA9548A or MCP9808. Just one EMC2101 connected via a Qwiic Shim.

Screenshot 2024-02-18 at 08 46 51

I installed the Library for the TCA9548A and MCP9808 to get past this and got the following.

Screenshot 2024-02-18 at 08 53 59

I also tried modifying the EMC2101.py script so that it just pulled/printed the temperature | speed value in the format that I believe it should be but no change in the UI.

Screenshot 2024-02-18 at 09 04 17

Thanks for your help!

wstan6 commented 8 months ago

It seems I need to put the 00 with no space?

Screenshot 2024-02-18 at 09 16 58

wstan6 commented 8 months ago

I also tried your fork of the Enclosure Plugin with the EM2101, no luck on controlling the fan or getting the temperature.

wstan6 commented 8 months ago

I also tried your fork of the Enclosure Plugin with the EM2101, no luck on controlling the fan or getting the temperature.

I got the temperature to display by disabling Use SUDO in the advanced section. The fan control cycles from 0 to 100%, could this be because of the speed not working correctly? I am using a Noctua 120mm NF-F12 IndustrialPPC 3000rpm.

Screenshot 2024-02-18 at 17 09 05

JeremyLaurenson commented 8 months ago

The plugin runs initially and check to see if there is a 2101 and/or 9808 Runt he EMCSCAN.py script... You should see the output of this in the log - one of these messages: 2101+9808 2101 9808 Not found You'll then see a list of channels, presumably with all "not founds"

Can you paste the output here?

Next, you should be able to ask for the data like you did but with a space between the 0s:

/home/wilson/oprint/lib/python3.9/site-packages/octoprint_emc2101/EMC2101-py 0 0

wstan6 commented 8 months ago

wilson@raspberrypi:~/oprint/lib/python3.9/site-packages/octoprint_emc2101 $ python EMCSCAN.py 0 | 2101 1 | Not found 2 | Not found 3 | Not found 4 | Not found 5 | Not found 6 | Not found 7 | Not found 8 | Not found wilson@raspberrypi:~/oprint/lib/python3.9/site-packages/octoprint_emc2101 $ python EMC2101.py 0 0 Traceback (most recent call last): File "/home/wilson/oprint/lib/python3.9/site-packages/octoprint_emc2101/EMC2101.py", line 50, in print('{0:0.1f} | {1:0.1f}'.format(temperature, fanspeed)) NameError: name 'temperature' is not defined

JeremyLaurenson commented 8 months ago

Hmm, its not getting values back for some reason.... In the EMC2101.py file lets have you add a line below the import adafruit_mcp9808: temperature = -1

JeremyLaurenson commented 8 months ago

Lets also have you try these commands in a few flavors: python3 EMC2101.py 0 0 sudo python EMC2101.py 0 0

wstan6 commented 8 months ago

Added the line.

wilson@raspberrypi:~/oprint/lib/python3.9/site-packages/octoprint_emc2101 $ python EMC2101.py 0 0 -1.0 | -1.0 wilson@raspberrypi:~/oprint/lib/python3.9/site-packages/octoprint_emc2101 $ python3 EMC2101.py 0 0 -1.0 | -1.0 wilson@raspberrypi:~/oprint/lib/python3.9/site-packages/octoprint_emc2101 $ sudo python EMC2101.py 0 0 -1.0 | -1.0

JeremyLaurenson commented 8 months ago

Yeah its failing to get the values.... How about sudo python3 EMC2101.py 0 0

JeremyLaurenson commented 8 months ago

So on the raspberry pi, depending how its set up your python environments may or may not have access to the i2c bus without being root... and you may have multiple python instances.... this is what we are battling here

wstan6 commented 8 months ago

Same output.

Makes sense, how can I go about fixing that?

JeremyLaurenson commented 8 months ago

Lets make sure you have all the right tools installed:

sudo apt-get install i2c-tools

wstan6 commented 8 months ago

Check.

JeremyLaurenson commented 8 months ago

Ok, lets step way back to basics and have you go through the Adafruit setup of the 2101 in python to get that working first:

https://learn.adafruit.com/emc2101-fan-controller-and-temperature-sensor/python-circuitpython

wstan6 commented 8 months ago

It must be some what correct as I can get the Temp in the Enclosure Plugin, I have the Enclosure Plugin disabled at the moment.

I've been through that page and have a test script working.

JeremyLaurenson commented 8 months ago

Hm... I wonder if the issue is that something else has the sensor "open". Can you try uninstalling that Enclosure plugin and rebooting... It's possible it didnt release properly.

wstan6 commented 8 months ago

Uninstalled the Enclosure Plugin, got this now. The fan is also cycling from 0 to 100. If I remove the temperature = -1 line it goes back to default.

Screenshot 2024-02-19 at 00 18 38

wstan6 commented 8 months ago

Could this be it, I can't find any file "adafruit_EMC2101.mpy".

Screenshot 2024-02-19 at 00 44 34

JeremyLaurenson commented 8 months ago

Ok, so lets turn back on the Use SUDO in advanced...

wstan6 commented 8 months ago

I did that in the Enclosure Plugin. Is there an option in this one?

wstan6 commented 8 months ago

After disconnecting/reconnecting the 2101 the fan is not pulsing 0 to 100 and I can use the Low Fan Speed setting to control the fan and it works great. Just need to get the temperature/speed values coming through.

wstan6 commented 8 months ago

Re: Fan Speed. On my 2101 the pull up jumper on the back is disconnected by default, joining this fixed my erroneous speed values. Also connecting the GND to 12V fan GND seems to have no affect.

So communication to the 2101 is working great for the test script, we just need to work out why yours doesn't?

wstan6 commented 8 months ago

When I run the original EMC2101.py I get this now.

wilson@raspberrypi:~/oprint/lib/python3.9/site-packages/octoprint_emc2101 $ python EMC2101.py -1 | -1