I am using a Arduino Pro Mini with HC12 for communication. As the A0 pin needs to stay afloat I am in a fix on how to connect the Analog Soil Moisture sensor to the Arduino Pro Mini?
Anyone on the forum who has faced similar situation?
your efforts in designing this system are tremendous and your support on it is like a cherry on top of a delicious ice-cream :-)
once i calibrate the Analog sensor to read through the wireless i will check the distance and report back.
the implementation was all thanks to your valuable inputs and feedback from time to time otherwise without which it would have been a uphill task for me.
my observation.... there are 2 Red LED's on the Pro Mini... and is it normal for one of it to remain on continuously? while the other switches on while transmission and then switches off.
will the power consumption of the the LED which remains on continuously affect the battery life?
I'll try to understand if I can ship a couple of my sensors to you.
This is a very encouraging statement by you and I thank you for the same. Although don't go out of your way to do it. Your words of support are more than enough for me to work further on this project. :-)
i will soon be opening another "episode" :-) as you rightly said on the analog sensor calibration as i am struggling to get it working in reference to the reading and then converting it to percentage. let me try though! :-)
i again sincerely thank you for all your help and support!!! 😊
Please keep me updated about the distance you can reach with this system.
Actually I chose the HC-12 + Arduino instead of LoRa devices because I want to make a simplified radio system which is less expensive as possible. This will enable more automation and farmers will have more time to dedicate to other tasks. I'm happy that the first implementation that I'm aware of is from India.
I'll try to understand if I can ship a couple of my sensors to you.
For the Watering automation we can open another episode :)
Now it look OK also from the Arduino side, from the serial output we can see that the HC12 answer the commands from the Arduino. The messages appear to be sent via radio but there is no acknowledge message from the raspberry side, so it tries to send again for other 2 times, then it repeats the cycle with a new message.
The missing point is why the raspberry does not receive the message and send the acknowledge.
Sorry to ask again, but I see that the previous setting in the Raspberry have the FU4 mode, but here I see the FU3 in the Arduino. F mode and Channel number are essential to be aligned for the communication.
I suppose the two devices are very close for the testing, can you try without the external antenna?
Another thing can you reboot the raspberry, wait 5 minutes and download the log file in the HardwareSetting page (current log file).
It would also be interesting if you can switch the HC12 from the Arduino to the raspberry and check the SW version of the other HC-12 using the Query commands on the raspberry side.
Here I made a testing with your setting (FU4), as soon as I put the right channel in to the Raspberry setting, the Arduino got the Acknowledge:
From the raspberry side everything seems to work properly and the HC12 provides the required answers to the query.
I see the problems on the Arduino side, the lasted output you have posted indicates that the HC12 is not able to communicate with the Arduino, which tries to reset multiple times. This looks more like a connection problem, If possible can you send a picture of the connections from the HC12 to the Arduino?
The previous output was different, did you change something?
Here what you should see in the starting sequence when the HC12 communicates properly with the Arduino:
The channel on both the RPI and Arduino are now 1 and tried it but was unsuccessful.
Following are query commands on RPI for HC12
AT+RB = OK+B1200
AT+RC = OK+RC001
AT+RF = OK+FU4
AT+RP = OK+RP:+20dBm
AT+V = www.hc01.com HC-12 v2.6
I did purchase the HC12 at the same time from the vendor.. but I am not sure about the batch as they are packed in unmarked packets. Also I am unable to check the Version on the HC12 connected to the Arduino.
I am now getting the following serial output from the Arduino.
9600NO answer from UARTEND UART checkAT+P8AT+C001AT+B1200AT+FU4primosecondoRandom Seed=509ResetHere we are1200NO answer from UART9600NO answer from UARTEND UART checkAT+P8AT+C001AT+B1200AT+FU4primosecondoRandom Seed=257ResetHere we are1200NO answer from UART9600NO answer from UARTEND UART checkAT+P8AT+C001AT+B1200
From what I see, the sensor with Arduino and HC12 is sending the radio signal, it waits for the Raspberry to reply but it gets no answer.
From the screenshot of the Hydrosys4 HC12 setting that you posted above, I see that the channel you are using is the Channel 3, while in the arduino the channel is 1, maybe this is the issue.
It looks like the The HC12 Arduino side is transmitting on channel 1, according to the specs the HC12 initial channel is at 433.4 MHz (subsequent channels will be spaced 400KHz).
On the raspberry HC12 setting you can also query the HC12 to check the channel , mode and power (also the version).
Unfortunately I read that different HC-12 SW versions seems to be not compatible. Did you purchase the HC12 from the same batch?
I just checked using a SDR for the 433 Mhz frequency band and every 30 seconds as defined in the Arduino Code I see a burst of the signal.
Below is the screenshot with the marker on the signal that I received at 433.3968 Mhz which is happening perfectly at every 30 seconds as defined in the Arudino Code.
Also please find the following screenshot of the Serial output of the Arudino Nano Board.
Following is the code in main.cpp that I am using
// ################################################################################################################// Number of sensor + chiper key part + HC12 setting + Sleep time ********************************************************#define MAX_SENSORS 2 // Number of Slowwire sensors defined and conected#define SLEEP_TIME_mSEC 30000 // example 1800000 is 30 minutescharcipherkey[]="default"; // chipher key// wireless parameters SettingcharAT_TX_mode[]="AT+FU4"; // format AT+FUx possible values "AT+FU3","AT+FU4" (FU4 is used for long distance transmssion)charAT_TX_power[]="AT+P8"; // format POWER AT+Px where X ranges from 1 to 8charAT_Channel[]="AT+C001"; // format CHANNEL AT+Cxxx where xxx range from 001 to 100// End Setting ****************************************************************************************************// ################################################################################################################
following are parameter on the Hydrosys4 and Arduino...
Hydrosys4 Screenshot below:
Arudino Pro Mini Code Screenshot below:
I have checked and double checked the above parameters to see that they remain same and then I flashed the Arduino Pro mini with the code but still it is not able to communicate with the Hyrdrosys4.
The error page below:
I ran the HC12 AT commands given on the Hydrosys4 and all them replied with a OK!
Can you please guide me further on where I might be going wrong?
downloaded and re flashed the card with the new image.
then i still could not see the HC12... and then i realized i had to enable Serial via SSH... 😋
then i was breaking my head over SSH password when on the forum i found you have changed the default password for SSH. 😀
enabled the serial, Refreshed from Hardware Settings and the HC12 menu was there in the settings page. 😃
now the struggle moves on to the sensor side with a analog soil moisture sensor and HC12 integration... will keep you posted on the happening at the sensor side.
The fastest way is to download the SD image and burn it on the SD card. If you want to save your current configuration, download the configuration file from setting page - system configuration download. Then after you run the SD card with the new version you can upload the file from the setting page
The HC12 button only appear when the system actually communicate with the HC12 hardware. It is required to update the hydrosys4 to the latest version. In case the system boots without the HC12 connected to it, you will not see the interface. To make the hydrosys4 check the presence of HC12 you can click the refresh button in the hardwaresetting page.Let me know if you make progress on it
frankly I would have loved to buy your Digital Soil Moisture Sensor from Tindie but it cannot be shipped to India and also the shipping cost would be more than the cost of the sensor I suppose.
infact most of your hardware is just "wonderful" but unable to bring it to India.
i am trying to see if i can get a circuit for a digital sensor to make them locally here but unable to get them either so am stuck with analog sensors.
attached image of how I am implementing the RPi and the allied relays.
need to make some clarifications about the soil moisture sensor.
The arduino code is currently written to interface with my Soil moisture sensor, which is a digital capacitive sensor. This means that there will be a digital transmission going on between arduino and the sensor.
There are primarily two reason for this choice and are mostly relevant to the battery:
- using 3.7v battery, it is required that the sensor works with low voltage (less than 3v)
- using battery it is important that the sensor consume very little power when it is idle
Both of the above are included in my sensor design.
On the other side, if battery power supply is not an issue then I think it is a good idea to modify the Arduino sketch to support the analog inputs.
unfortunately as you may understand the modification is not as immediate, anyway I think I can do it when I have time.
finally the prototype deployment using HC12 + Arduino Pro Mini.
powered by a 7.4V (2200 mah) Li-Ion Battery pack stepped down using a DC-DC Buck convertor to give a 5V Output.
analog soil moisture sensor connected to the A1 of the Pro Mini.
solar panel on the right side is connected in parallel to the battery pack giving an output of 8V so battery keeps charging!
please do consider giving me inputs if i have placed anything wrongly or out of context.
hi,
your efforts in designing this system are tremendous and your support on it is like a cherry on top of a delicious ice-cream :-)
once i calibrate the Analog sensor to read through the wireless i will check the distance and report back.
the implementation was all thanks to your valuable inputs and feedback from time to time otherwise without which it would have been a uphill task for me.
my observation.... there are 2 Red LED's on the Pro Mini... and is it normal for one of it to remain on continuously? while the other switches on while transmission and then switches off.
will the power consumption of the the LED which remains on continuously affect the battery life?
This is a very encouraging statement by you and I thank you for the same. Although don't go out of your way to do it. Your words of support are more than enough for me to work further on this project. :-)
i will soon be opening another "episode" :-) as you rightly said on the analog sensor calibration as i am struggling to get it working in reference to the reading and then converting it to percentage. let me try though! :-)
i again sincerely thank you for all your help and support!!! 😊
That's a great news!
Please keep me updated about the distance you can reach with this system.
Actually I chose the HC-12 + Arduino instead of LoRa devices because I want to make a simplified radio system which is less expensive as possible. This will enable more automation and farmers will have more time to dedicate to other tasks. I'm happy that the first implementation that I'm aware of is from India.
I'll try to understand if I can ship a couple of my sensors to you.
For the Watering automation we can open another episode :)
hi,
so finally 3 hours ago it worked!
the Arduino + HC12 side was giving the issue I suppose and fault was mine!
i had powered the HC12 from the 5V rail directly and not through the Arduino.
now i have powered the HC12 5V from the Arduino and hence the HC12 is reset by the Arduino as per the script and communicating with the RPI + HC12
so it looks like the HC12 has to be compulsorily powered through the Arduino and not directly.
now my struggle would be to automate watering based on soil level moisture parameter using a Analog soil moisture sensor. :-)
thank you very much and appreciate your extended support and help in this entire episode :-)
Now it look OK also from the Arduino side, from the serial output we can see that the HC12 answer the commands from the Arduino. The messages appear to be sent via radio but there is no acknowledge message from the raspberry side, so it tries to send again for other 2 times, then it repeats the cycle with a new message.
The missing point is why the raspberry does not receive the message and send the acknowledge.
Sorry to ask again, but I see that the previous setting in the Raspberry have the FU4 mode, but here I see the FU3 in the Arduino. F mode and Channel number are essential to be aligned for the communication.
I suppose the two devices are very close for the testing, can you try without the external antenna?
Another thing can you reboot the raspberry, wait 5 minutes and download the log file in the HardwareSetting page (current log file).
It would also be interesting if you can switch the HC12 from the Arduino to the raspberry and check the SW version of the other HC-12 using the Query commands on the raspberry side.
Here I made a testing with your setting (FU4), as soon as I put the right channel in to the Raspberry setting, the Arduino got the Acknowledge:
attaching photos of the Arduino Pro Mini + HC12 wiring.
Pro Mini has been flashed with HC-12encoding_analog_v1.4(Pro-MINI) code.
The Pro Mini VCC,GND,Tx,Rx are connected via USBASP to flash and also read the serial output when the program runs.
The Pro Mini is receiving the 5V from the USBASP cable and I have flashed the fresh code by downloading it again from Github.
the HC12 is connected as follows:
HC12 Tx <--> Pro Mini Pin 10
HC12 Rx <--> Pro Mini Pin 11
HC12 SET <--> Pro Mini Pin 6
HC12 5V <--> Pro Mini Pin Vcc
HC12 Tx <--> Pro Mini Pin Gnd
The following are Serial Port Output when powered on...
in continuation with the above output following is then output I get when I press the Reset button on the Arduino Pro Mini.
From the raspberry side everything seems to work properly and the HC12 provides the required answers to the query.
I see the problems on the Arduino side, the lasted output you have posted indicates that the HC12 is not able to communicate with the Arduino, which tries to reset multiple times. This looks more like a connection problem, If possible can you send a picture of the connections from the HC12 to the Arduino?
The previous output was different, did you change something?
Here what you should see in the starting sequence when the HC12 communicates properly with the Arduino:
Here we are
1200
OK+B1200
found
END UART check
AT+P8
OK+P8
found
AT+C001
OK+C001
found
AT+B1200
OK+B1200
found
AT+FU4
OK+FU4
found
Hi,
The channel on both the RPI and Arduino are now 1 and tried it but was unsuccessful.
Following are query commands on RPI for HC12
AT+RB = OK+B1200
AT+RC = OK+RC001
AT+RF = OK+FU4
AT+RP = OK+RP:+20dBm
AT+V = www.hc01.com HC-12 v2.6
I did purchase the HC12 at the same time from the vendor.. but I am not sure about the batch as they are packed in unmarked packets. Also I am unable to check the Version on the HC12 connected to the Arduino.
I am now getting the following serial output from the Arduino.
9600 NO answer from UART END UART check AT+P8 AT+C001 AT+B1200 AT+FU4 primo secondo Random Seed=509 Reset Here we are 1200 NO answer from UART 9600 NO answer from UART END UART check AT+P8 AT+C001 AT+B1200 AT+FU4 primo secondo Random Seed=257 Reset Here we are 1200 NO answer from UART 9600 NO answer from UART END UART check AT+P8 AT+C001 AT+B1200
From what I see, the sensor with Arduino and HC12 is sending the radio signal, it waits for the Raspberry to reply but it gets no answer.
From the screenshot of the Hydrosys4 HC12 setting that you posted above, I see that the channel you are using is the Channel 3, while in the arduino the channel is 1, maybe this is the issue.
It looks like the The HC12 Arduino side is transmitting on channel 1, according to the specs the HC12 initial channel is at 433.4 MHz (subsequent channels will be spaced 400KHz).
On the raspberry HC12 setting you can also query the HC12 to check the channel , mode and power (also the version).
Unfortunately I read that different HC-12 SW versions seems to be not compatible. Did you purchase the HC12 from the same batch?
I just checked using a SDR for the 433 Mhz frequency band and every 30 seconds as defined in the Arduino Code I see a burst of the signal.
Below is the screenshot with the marker on the signal that I received at 433.3968 Mhz which is happening perfectly at every 30 seconds as defined in the Arudino Code.
Also please find the following screenshot of the Serial output of the Arudino Nano Board.
Following is the code in main.cpp that I am using
// ################################################################################################################ // Number of sensor + chiper key part + HC12 setting + Sleep time ******************************************************** #define MAX_SENSORS 2 // Number of Slowwire sensors defined and conected #define SLEEP_TIME_mSEC 30000 // example 1800000 is 30 minutes char cipherkey[]="default"; // chipher key // wireless parameters Setting char AT_TX_mode[]="AT+FU4"; // format AT+FUx possible values "AT+FU3","AT+FU4" (FU4 is used for long distance transmssion) char AT_TX_power[]="AT+P8"; // format POWER AT+Px where X ranges from 1 to 8 char AT_Channel[]="AT+C001"; // format CHANNEL AT+Cxxx where xxx range from 001 to 100 // End Setting **************************************************************************************************** // ################################################################################################################
hi,
following are parameter on the Hydrosys4 and Arduino...
Hydrosys4 Screenshot below:
Arudino Pro Mini Code Screenshot below:
I have checked and double checked the above parameters to see that they remain same and then I flashed the Arduino Pro mini with the code but still it is not able to communicate with the Hyrdrosys4.
The error page below:
I ran the HC12 AT commands given on the Hydrosys4 and all them replied with a OK!
Can you please guide me further on where I might be going wrong?
Maybe some parameters have been changed in the default configuration,
So it is require to check if they are the same in the Hydrosys4 setting and in the Arduino code.
I already see that the picture in the documentation is not aligned:
for example the arduino code is FU4, while the Hydrosys4 is FU3, also the channel in Arduino is 3, but in hydrosys4 is 1.
Definitely I need to align the documentation.
Let me know if you make progress.
unable to read the sensor data using a Arudino Pro Mini + HC12 + Analog Soil Moisture Sensor connected to A1 on the ProMini
using the Analog Sensor file you have shared.
Hi,
downloaded and re flashed the card with the new image.
then i still could not see the HC12... and then i realized i had to enable Serial via SSH... 😋
then i was breaking my head over SSH password when on the forum i found you have changed the default password for SSH. 😀
enabled the serial, Refreshed from Hardware Settings and the HC12 menu was there in the settings page. 😃
now the struggle moves on to the sensor side with a analog soil moisture sensor and HC12 integration... will keep you posted on the happening at the sensor side.
thank you so much for all this help!
-Sid
The fastest way is to download the SD image and burn it on the SD card. If you want to save your current configuration, download the configuration file from setting page - system configuration download. Then after you run the SD card with the new version you can upload the file from the setting page
The HC12 button only appear when the system actually communicate with the HC12 hardware. It is required to update the hydrosys4 to the latest version. In case the system boots without the HC12 connected to it, you will not see the interface. To make the hydrosys4 check the presence of HC12 you can click the refresh button in the hardwaresetting page. Let me know if you make progress on it
hi,
somehow the HC12 interface is not showing up in my Setting page.
i followed everything step by step as you have described at https://hydrosysblog.wordpress.com/2021/07/25/long-range-wireless-sensors-with-hc12-but-not-lora/
do i need to upgrade the hydrosys4 on raspberry pi too??
It's true, unfortunately shipping costs and reliability of the delivery are a problem.
Anyway I updated the Arduino SW to read the analog inputs and transmit them wireless with the HC-12.
You can have a look at it here:
frankly I would have loved to buy your Digital Soil Moisture Sensor from Tindie but it cannot be shipped to India and also the shipping cost would be more than the cost of the sensor I suppose.
infact most of your hardware is just "wonderful" but unable to bring it to India.
i am trying to see if i can get a circuit for a digital sensor to make them locally here but unable to get them either so am stuck with analog sensors.
attached image of how I am implementing the RPi and the allied relays.
Hi,
need to make some clarifications about the soil moisture sensor.
The arduino code is currently written to interface with my Soil moisture sensor, which is a digital capacitive sensor. This means that there will be a digital transmission going on between arduino and the sensor.
There are primarily two reason for this choice and are mostly relevant to the battery:
- using 3.7v battery, it is required that the sensor works with low voltage (less than 3v)
- using battery it is important that the sensor consume very little power when it is idle
Both of the above are included in my sensor design.
On the other side, if battery power supply is not an issue then I think it is a good idea to modify the Arduino sketch to support the analog inputs.
unfortunately as you may understand the modification is not as immediate, anyway I think I can do it when I have time.
Will keep you updated.