In both Illinois and Iowa it is your legal right to record the police during a traffic stop (or when the police stop you on foot). You do not need the permission from the police to record. You do not need to inform the police that you are recording.
Recording the police, whether they are stopping you, someone you know, or a stranger, helps deter the police from engaging in brutality and helps ensure that justice can be had if they do engage in brutality.
A guide on the law surrounding recording the police, published by First Amendment Watch out of New York University, can be seen here: https://firstamendmentwatch.org/wp-content/uploads/2020/06/Citizens-Guide-to-Recording-the-Police-2.pdf