The dynamics of a cylinder arranged between two side walls was experimentally investigated. The gap between the cylinder and the walls is considered narrow sufficiently to allow the cylinder to contact the side walls. In the present study, we want to clarify the dynamics change of the cylinder induced by the periodic impact on the walls. We considered the gap ratio between the cylinder and the side walls, $e/D$ as the main variable. The side walls affected dramatically to the dynamics of the circular cylinder depending on whether the cylinder contacts the side walls or not. As a common phenomenon that occurred in both of the cylinders with and without contact, there is the shift of the lock-in regime to a lower reduced velocity. For the circular cylinder contacting the side walls, the walls allowed the cylinder to oscillate even outside the lock-in regime. Besides, the oscillating frequency of the contacting cylinder significantly increased than the isolated cylinder. To compare the dynamics changed induced by the presence of the side walls, the additional experiments were conducted with a square cylinder. Whereas the side walls give positive effects to the circular cylinder from the perspective of the energy harvesting, the square cylinder with two side walls just showed the decrement of the oscillating amplitude.