Home › Forums › Mayfly Data Logger › Pin locations for Yosemitech Y510-B
- This topic has 7 replies, 2 voices, and was last updated 2022-01-06 at 12:52 PM by Liz.
2022-01-05 at 8:23 PM #16227
I am having an issue on getting my Yosemitech Y510-B Turbidity and Y504 dissolved oxygen sensor working. Currently my program is logging but for both sensors the output is continuously -9999 and NULL in sensor testing mode. The Y510 Turb sensor’s RS485 TXD LED will light with every sensor reading so I believe it is getting the power and sending data however something is not right, the y504 DO Sensor RS485 is not responding at all.
Turb sensor is hooked up to an RS485 with the green wire of the Y510-B to A+ on the RS485 and the white sensor wire to the B-. The sensor GND and power are hooked to a grove screw terminal connecting to one of the 5v ports on the 0.5b Mayfly. I think it could be my pin locations on the mayfly and or pin declaration on my program that I am unsure if they are all declared right. Currently the RS485 wires connected to the Y510-B into the mayfly are as follows: GND to GND, RXD to D11, TXD to D8, and VCC to sv5. I am using altsoftserial. And the pin declaration of my code is attached.
DO sensor is hooked up to an RS485 with the green wire of to A+ on the RS485 and the white sensor wire to the B-. the RS485 GND wire connects to an envirodiy grove screw terminal GND, RS485 RXD to the grove D1, RS485 TXS to the grove D2, and the RS485 VCC in grove VCC. The GND and Power wires of the sensor are soldered to an DC Setup booster out+ and out-. connecting to the mayfly the DC boost in+ is in analog sv5 and the in- GND.
Hopefully this is able to be followed, I am able to elaborate further if needed.
Here is the code for the Yosemitech Y510 Turbidity Sensor, and the altsoftserial1234567891011121314151617181920212223242526272829#include <AltSoftSerial.h>AltSoftSerial altSoftSerial;// // ==========================================================================// // Yosemitech Y510 Turbidity Sensor// // ==========================================================================// /** Start [y510] */#include <sensors/YosemitechY510.h>#include <ModSensorDebugger.h>// #if defined MS_BUILD_SENSOR_Y510//// #endifAltSoftSerial &modbusSerial = altSoftSerial; // For software serial if needed// // NeoSWSerial &modbusSerial = neoSSerial1; // For software serial if needed// //#endif// // NOTE: Extra hardware and software serial ports are created in the "Settings// // for Additional Serial Ports" section//byte y510ModbusAddress = 0x0B; // The modbus address of the Y510const int8_t y510AdapterPower = sensorPowerPin; // RS485 adapter power pin// // (-1 if unconnected)const int8_t y510SensorPower = sensorPowerPin; // Sensor power pinconst int8_t y510EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable)const uint8_t y510NumberReadings = 5;
Here is the code for the Dissolved oxygen sensor12345678910111213141516171819202122232425262728//==========================================================================//Yosemitech Y504 Dissolved Oxygen Sensor//==========================================================================/** Start [y504] */#include <sensors/YosemitechY504.h>#include <ModSensorDebugger.h>// #if defined MS_BUILD_SENSOR_Y504//// #endif//AltSoftSerial &modbusSerial = altSoftSerial;// For software serial if needed// // NeoSWSerial &modbusSerial = neoSSerial1; // For software serial if needed// //#endif// // NOTE: Extra hardware and software serial ports are created in the "Settings// // for Additional Serial Ports" section//// NOTE: Extra hardware and software serial ports are created in the "Settings// for Additional Serial Ports" sectionbyte y504ModbusAddress = 0x04; // The modbus address of the Y504const int8_t y504AdapterPower = sensorPowerPin; // RS485 adapter power pin// (-1 if unconnected)const int8_t y504SensorPower = sensorPowerPin; // Sensor power pinconst int8_t y504EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable)const uint8_t y504NumberReadings = 5;
2022-01-05 at 9:08 PM #16228
AltSoftSerial only works on pins 5 and 6. That’s why there’s no place in the code to declare the Tx and Rx pins. It’s strictly limited to those two.
Is there a reason you have the two sensors on separate RS485 adapters and power supplies? I’m fairly certain that the two sensors operate on the same supply voltage. I’d suggest using the same power supply and RS485 adapter for both using terminal blocks or one of the 4 port Grove splitters to connect the lines. With only one RS485 adapter, you can connect it to the required 5&6 and use AltSoftSerial. If you really need to have different supplies and adapters, you’ll need to use NeoSWSerial or just regular SoftwareSerial for at least one of the sensors. Make sure all your various grounds are connected so you have a single common ground level.
Are you sure you have the right modbus addresses for each sensor? If you haven’t intentionally changed it, they come from the factory set as 0 or 1 – I don’t remember which. If the two sensors are in line on the same serial loop, at least one needs to be changed to a different address. If you separate them, they can have the same address. No matter how your do it, the code has to match what the sensors are set to or the sensors will just ignore the commands. Use the functions in the Yosemitech library or their Windows program to change the address.
During communication, if it’s wired right, the TX and Rx lights on your adapter should both flash extremely quickly. You should be able to tell they’re flickering, not steadily on.
What kind of adapter are you using? You should be using one with automatic flow control and powering the adapter itself at 3.3V. For every board I’ve seen, the Rx and Tx voltages will match with the Vcc voltage of the adapter. The Mayfly processor is running at 3.3V, giving it anything over 3.6 V risks frying it. So *don’t* power your adapter off the Mayfly 5V. If you have a 5V only adapter or one without flow control, just buy a new one. It’s near impossible to get the level shifting and flow timing perfect enough to communicate and it’s not worth the effort.
2022-01-06 at 11:15 AM #16230
Thank you so much for answering me I have been stuck for quite some time.
To answer your questions, I am running them separate because my Y504 Sensor requires 6+volts and needed a DC step up booster board and the Y510 sensor needs 5volts. Would it still be possible to put them on one RS485 and power supply?
I am unfamiliar with the NeoSWSerial, is there a place on envirodiy to look up how this one work and how to code it in and the pins etc.?
I had not touched the addresses for either of the sensors, correct, me if this is wrong, if I put the sensors on one power supply and adapter, they have to have separate addresses? So at least one needs to be changed through yosemitech library, but If I keep them separate and use the NeoSWserial for at least one, I can keep the two sensors at the original addresses?
I am using an Amazon ALMOCN TTL to RS485 Adapter Module 3.3V 5V 485 to TTL Signal Single Chip Serial Port Level Converter Borad with RXD, TXD Indicator. It does not say flow control at all, but it does say it can match the module.
I am still slightly confused on your last paragraph, is that referring to the Sv5 pins and/or the mayfly ports set to 5v?
Again, thank you!
2022-01-06 at 11:46 AM #16231
There’s no enable pin broken out, so it must have automatic flow control. That’s what you want. This one, right: https://www.amazon.com/ALMOCN-Adapter-Module-Converter-Indicator/dp/B09998FY4X?th=1
Currently the RS485 wires connected to the Y510-B into the mayfly are as follows: GND to GND, RXD to D11, TXD to D8, and VCC to sv5.
If the Vcc of the adapter is hooked to the 5V of the Mayfly; it’s powered at 5V and has 5V TTL and you’re risking frying you’re Mayfly’s processor. Don’t do that. Use 3.3V or 3.3V switched for the adapter. Use >5V for the sensor.
On their website, Yosemitech still lists the DO sensor as 6-12V and turbidity at 5-12V. So their range mostly overlaps. In real life, I remember the DO sensor actually responding at only 5V. Both would be very happy with either 6V or 12V supply. If you’re going to try to power everything through boost converters off the Mayfly, you should start with the 3.3V instead of using the Mayfly to boost from 3.3V to 5V and then another stepper to move from 5V to 6 or 12V.
Here’s a really ugly drawing:
2022-01-06 at 11:58 AM #16233
Changing the address via the Yosemitech library is not hard. I would strongly recommend you do that rather than mess with two adapters and two serial lines. No matter what, I’m positive that the default addresses are not
0x0Bas you have them coded. Those are just my favorite addresses for them.
If you really want two separate connections, here’s NeoSWSerial and the neutered version of SoftwareSerial that you need to use to work with ModularSensors. Also, read the docs!
2022-01-06 at 12:39 PM #16234
I just took off my DO sensor and am now testing the Turb (Y510) alone, I just moved the RXD and TXD from the adapter to pin 5 and 6. However when I do so only the TXD LED lights up when TXD wire is in pin D5 and the RXD LED will not light up, but when I plug the D6 and reverse the two pins only RXD LED lights up. So, I cannot get both LEDS to flicker and either way 5 or 6 the sensor is outputting -9999. So currently either one of the two LED lights are steadily on not flickering.
2022-01-06 at 12:42 PM #16235
Oh sorry I just saw your other comments. Thank you! I will get to testing that.
2022-01-06 at 12:52 PM #16236
I do believe my DO sensor right now is fried from another mishap, so I am trying to get just the Turbidity sensor to work currently.
- You must be logged in to reply to this topic.