You’ll want to put the observers directly on top of the pistons, and instead of having one, have an individual one for each piston (not required, but it would speed it up a lot)
Those observers should be facing the sugar cane. Then, place a block on the back side of the observers, and a piece of redstone dust under that block (you can place blocks down so that you have somewhere to put the redstone dust)
In my experience this is the best way to do it. Happy farming!
You’ll want to put the observers directly on top of the pistons, and instead of having one, have an individual one for each piston (not required, but it would speed it up a lot) Those observers should be facing the sugar cane. Then, place a block on the back side of the observers, and a piece of redstone dust under that block (you can place blocks down so that you have somewhere to put the redstone dust)
In my experience this is the best way to do it. Happy farming!