RastoH / eXtended-Coop-Controller

Control chicken coop with ESP8266 - automatic chicken coop door, Hen Light, Coop Light, Heater, Fan, water ....
4 stars 0 forks source link

Lolin AT8870 Motor Shield #6

Closed helidave closed 1 year ago

helidave commented 1 year ago

I am using the above shield (it was the only one I could find!) and it works correctly when I test it on the bench using an Arduino Nano and the lolin test software. When I try it (piggy backed) onto the main board I get no output. I have tried both Port A and Port B. I believe the software communicates with the board over I2C as if I remove the board I get the expected error. I do notice that under "system" it comes up as LOLIN V2 board whereas in reality it is the v1.0 AT8870 board. The motor board is fed from my bench PSU and the WEMOS is fed from a 2A USB. I also tried using the coop light commands to see if that forced an output on either port but also without success. Thanks in advance.

helidave commented 1 year ago

I should mention, I checked the board address and it is 0x30 but I guessed that, as the board was being "seen" the dress was correct anyway. I also tried moving the AT8870 board to a separate place on the breadboard and just connecting the 3.3v/GND/SCL/SDA/5V Lines in case there was a conflict.

helidave commented 1 year ago

I have checked the board connections again and they all seem correct so I am guessing the address (0X30) indicated is correct for the board but not correct for the software. Looking at the YouTube video I see that its shows an address of 0X2D for the V2 board. I see in the Arduino examples page for the LOLIN board the address can be changed so I will see if that sorts it. I checked on the internet and couldn't find details of the default V2 address.

helidave commented 1 year ago

Okay...so much for that theory - I'm clearly doing something stupid because the software recognises the board with both the default address and the OX2D address. I wondered if the other channel controlling the coop light had an o/p so I put the motor one this and ran it from the light control command - success, the motor moves! So the motor shield is connected correctly, is recognised by the software and at least one channel is under control. The motor must be inhibited somewhere else. I will put a LED strip on the second channel to just confirm all is well and then back to the motor issue.

RastoH commented 1 year ago

Chanel A is used for door motor 1 - motor - 2

Chanel B is for LEDs 1 - LED STRIP - minus (shield GND) -> coop light 2 - LED STRIP - minus (shield GND) -> hen light

https://github.com/RastoH/eXtended-Coop-Controller/blob/main/hardware/README.md

see http://yourip/log

I use 12V battery, 12Volt geared motor, 12Volt led strips

Notice: motor max run time is set to 20 seconds!

helidave commented 1 year ago

Im using a Lab PSU to test the unit on the bench and it all seems to work as expected except I cannot get an output on 1-A-B on the AT8870 V4 board. My motor is the GA25 6V 35rpm version (its what I was using on the coop before) and it works fine with the LOLIN motor test software. In fact, if I connect it to 1-B-2 instead of a LED it runs when I send the door open or close command (of course only in one direction). I do notice that, even though the Lights are not enabled in the settings tab, when I send a door open or close command the LED on 1-B-2 illuminates for a few seconds.

RastoH commented 1 year ago

update firmware to xCctrl.2022.05.31o. it works flawlessly in my coop (with LOLIN V2 [TB6612FNG]).

I have new 8870 boards, I will test them tomorrow.

RastoH commented 1 year ago

Tested, works.

Tested with 9Volts/200mA, using SGM25F-370 12Volt geared motor.

Dont tested on 6Volts, AT8870 is for 6.5Volts-38Volts

helidave commented 1 year ago

Hi, I know the AT8870 specifies a minimum voltage of 6.5 v so I feed it 8v from the lab PSU, the small dc 6V motor is fine with it on the test program and I have run these small motors before with up to 9v without issues so hope I can get away with it again, if not I will order the 12v version after Christmas. After the match today I am going to try the new code as you suggest. Many thanks. David

RastoH commented 1 year ago

my test http://192.168.4.1/log

[SETUP 414] ---=== Reset reason: External System ===--- [SETUP 733] BootVersion : 31 BootMode : SYS_BOOT_NORMAL_MODE CPU freq : 80 [SETUP 1056] --=== FIRMWARE: xCctrl.2022.05.31r-dev [build 221218] ===-- [SETUP 1384] > SIZE OF settings: 408, stav: 200, RTC: 8 [ERROR 1722] config file - Failed to open config. [SETUP 2059] [i2c] Scanning ... [SETUP 2404] [i2c] device found at address 0x2D [SETUP 2795] 0x2D => 0x30 Motor shield WEMOS V1.0.0 or LOLIN V2.0.0 [SETUP 3141] Motor shield LOLIN LOLIN V2 AT8870 motor driver Rev. 4 at 0x2D found [SETUP 3505] [i2c] scan done (1)===--- [SETUP 3860] RTC not installed..... [SETUP 4220] ---=== LightSensor ===--- [SETUP 4579] Using LDR on A0 [SETUP 4943] Ambient light intensity: 2 % [SETUP 5307] ---==== Door switches + motor ===--- [SETUP 5675] Door is ajar [SETUP 6043] Motor shield LOLIN V2 AT8870 at 0x2D [SETUP 6569] Accessory shield NONE [SETUP 7098] ---=== DallasTemperature ===--- [SETUP 7476] Found 0 devices. [WiFi 7857] --== WiFi SETUP ==-- [INFO 8250] Configure TCP (HTTP)webServer->... [INFO 8638] HTTP server start.... [SETUP 9028] HTTP server started. [SETUP 9419] --== SYSTEM START ==-- [WiFi 9814] --== WiFi INIT ==-- [WiFi 10209] --== AP -> ON ==-- [WiFi 11014] mode change OFF -> AP [WiFi 12301] SoftAP: kurnicek-b597db start [WiFi 12809] --== STA -> ON ==-- [WiFi 13222] mode change AP -> STA+AP [WiFi 13731] WiFi STA: conect to SKYNET start [WiFi 17512] Station Connected to SKYNET, channel 1 [INFO 2022-12-18T16:12:43M19701] sntp => RTC update Mon Dec 18 16:12:43 2022 [INFO 2022-12-18T16:12:44M20133] ---=== [calculate TimeLord] ===--- [INFO 2022-12-18T16:12:44M20570] Sunrise (open) Time: 07:21 18/12/2022 [INFO 2022-12-18T16:12:45M21010] Sunset (close) Time: 15:36 18/12/2022 [INFO 2022-12-18T16:12:45M21455] Dlzka dna: 495 min 08:15 [INFO 2022-12-18T16:12:45M21905] ------======[END]======------ [WEB 2022-12-18T16:13:37M73174] ---=== handleState POST ===--- [WEB 2022-12-18T16:13:37M73622] Close door manualy... [INFO 2022-12-18T16:13:38M74078] [MANUAL] door close [WEB 2022-12-18T16:13:45M81618] ---=== handleState POST ===--- [INFO 2022-12-18T16:13:46M82077] Stop door - manualy - will be put into manual mode. [WEB 2022-12-18T16:13:46M82543] Door will be put into manual mode.
RESET to re-enable automatic door control.
[WEB 2022-12-18T16:13:52M88631] ---=== handleState POST ===--- [WEB 2022-12-18T16:13:53M89110] Open door manualy... [INFO 2022-12-18T16:13:53M89597] [MANUAL] door open [WEB 2022-12-18T16:14:02M98037] ---=== handleState POST ===--- [INFO 2022-12-18T16:14:02M98527] Stop door - manualy [WEB 2022-12-18T16:14:03M99023] Door stop. [WEB 2022-12-18T16:14:20M116828] ---=== handleState POST ===--- [WEB 2022-12-18T16:14:21M117330]
Coop light intesity 5%
Hen light ON,
Hen light intesity 5% [INFO 2022-12-18T16:14:21M117846] Hen Light ON -> 5 [WEB 2022-12-18T16:14:25M121824] ---=== handleState POST ===--- [WEB 2022-12-18T16:14:26M122394]
Hen light intesity 40% [WEB 2022-12-18T16:14:29M125719] ---=== handleState POST ===--- [WEB 2022-12-18T16:14:30M126248]
Hen light OFF, [INFO 2022-12-18T16:14:30M126781] Light OFF [WEB 2022-12-18T16:14:35M131444] ---=== handleState POST ===--- [WEB 2022-12-18T16:14:36M131982]
Coop light intesity 45% [WEB 2022-12-18T16:14:38M133978] ---=== handleState POST ===--- [WEB 2022-12-18T16:14:38M134525]
Coop light ON [INFO 2022-12-18T16:14:39M135085] Coop Light ON -> 45 [WEB 2022-12-18T16:14:42M138241] ---=== handleState POST ===--- [WEB 2022-12-18T16:14:42M138801]
Coop light OFF [INFO 2022-12-18T16:14:43M139369] Light OFF

but firmware controls channel_a for motor and channel_b for coop/hen light on first motor shield. on second shield is channet_a for heater/fan and channel_b for water heater

from where is your AT8870 board?

I want to test the HR8833 board next week.

helidave commented 1 year ago

Hi, My AT board is from ALIEXPRESS but it seems to work ok with the test programs LOLIN provide. I just tried to load the new firmware into the D1 board but I get an "error loading page" message. I swapped computer (normally I use a Mac) to a win 10 ASUS I have just in case but I get the same message. If I try to load direct using the ESP Dwnloader it fails after a few minutes with a "try a slower baud rate" message but the min board rate is 115200 so I am unable to do that. I also tried a couple of alternative usb cables as I have notice these can be quite different depending on supplier but again, same results. I will have look at the log output as soon as the match finishes.

RastoH commented 1 year ago

now tested on lolin d1 mini 4.0.0 (problem with spi flash, litflefs overide), witty cloud, node-mcu v3, all 4MB flash, all works corect.

flashed with flash download tool 3.9.3 on win11

compiled new firmware with Wire.setClock(100000); tested on my coop, works great

helidave commented 1 year ago

Morning, Thanks for looking at this for me, much appreciated!! Tested this morning on a Lolin MINI 4.0 and I now have motor control - fantastic. At the moment the system is on a breadboard but I will try the LED lights later today and if they work I will transfer it to a proper enclosure for the coop. The Temperature sensors work well. I have a small problem with the RTC time settings, they are working but the sunrise and sunset times seem to be out by a couple of hours. I have set the Long/Lat to my coordinates. I will spend a little time checking my settings later today. I loaded the binaries using Win 10. I think this is the best coop control/monitor I have seen on the net, thank you for making it public. I will add a photo when I get it all installed.

RastoH commented 1 year ago

not tested with other lon/lat and time zone. I can try your parameters

helidave commented 1 year ago

My location is set as 46.5633 - 3.3306. Sunrise and sunset should be 08:28 & 17:01 but are shown as 03:54 & 15:49. They don't seem to change no matter what location I give. I synced the server etc.

helidave commented 1 year ago

Just checked and if I set 46.5633N/3.3306E then times change to 06:54 & 19:01. The system clock is spot on .

RastoH commented 1 year ago

Longtitude: 3.3306 Latitude: 46.5633

change it!

Latitude is a coordinate that specifies the north–south position of a point on the surface of the Earth or another celestial body Longitude is a geographic coordinate that specifies the east–west position of a point on the surface of the Earth, or another celestial body

see: https://github.com/RastoH/eXtended-Coop-Controller/blob/main/webUI/readme.md#2114-automatic-mode

helidave commented 1 year ago

Oops - I blame it on my Covid vaccination!